Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some zvals are missing in memory dump for classes with the __debugInfo magic. #135

Open
vtsykun opened this issue Feb 18, 2024 · 0 comments · May be fixed by #136
Open

Some zvals are missing in memory dump for classes with the __debugInfo magic. #135

vtsykun opened this issue Feb 18, 2024 · 0 comments · May be fixed by #136

Comments

@vtsykun
Copy link

vtsykun commented Feb 18, 2024

STR

  1. Run script
<?php declare(strict_types=1);

namespace AAA;

unset($GLOBALS['_POST'], $GLOBALS['_COOKIE'], $GLOBALS['_FILES'], $GLOBALS['argv'], $GLOBALS['_GET'], $GLOBALS['_SERVER'], $GLOBALS['argc'], $GLOBALS['argv']);

class MTProtoBug
{
    private int $v = 1;
    private array $info = [];

    public function __debugInfo(): array
    {
        $vars = get_object_vars($this);
        unset($vars['info']);
        return $vars;
    }
}

$bug = new MTProtoBug();
\meminfo_dump(\fopen('/tmp/mem_dump.json', 'w'));

Actual result

{
  "header" : {
    "memory_usage" : 360456,
    "memory_usage_real" : 2097152,
    "peak_memory_usage" : 429360,
    "peak_memory_usage_real" : 2097152
  },
  "items": {
    "0x7fd6f746a140" : {
        "type" : "object",
        "size" : "72",
        "symbol_name" : "bug",
        "is_root" : true,
        "frame" : "<GLOBAL>",
        "class" : "AAA\\MTProtoBug",
        "object_handle" : "1",
        "children" : {
            "v":"0x7fd6f745ca40"
        }
    },
    "0x7fd6f745ca40" : {
        "type" : "int",
        "size" : "16",
        "is_root" : false
    }
}
}

Expect result

MTProtoBug->info must persist in the memory dump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant