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

Children items not properly linked in PHP 7 #76

Closed
BitOne opened this issue Aug 13, 2018 · 0 comments
Closed

Children items not properly linked in PHP 7 #76

BitOne opened this issue Aug 13, 2018 · 0 comments

Comments

@BitOne
Copy link
Owner

BitOne commented Aug 13, 2018

From this code:

<?php
unset($_GET);
unset($_FILES);
unset($_POST);
unset($_SERVER);
unset($_COOKIE);
unset($argv);
unset($argc);

class MyClass {
    public $myDeclaredVar;
}

$myObject = new MyClass();
$myObject->myDeclaredVar = "My declared var content";
$myObject->myUndeclaredVar = "My undeclared content";
$myObject->chilObject = new StdClass()

meminfo_dump(fopen('php://stdout', 'w'));

The output from the PHP 7 extension shows:

"items": {
    "0x7fd5bc0561f8" : {
        "type" : "object",
        "size" : "72",
        "symbol_name" : "myObject",
        "is_root" : true,
        "frame" : "<GLOBAL>",
        "class" : "MyClass",
        "object_handle" : "1",
        "children" : {
            "myDeclaredVar":"0x7fd5bc05d8e0",
            "myUndeclaredVar":"0x7fd5bc05d900",
            "chilObject":"0x7fd5bc05d920"
        }
    },
    "0x7fd5bc056220" : {
        "type" : "string",
        "size" : "39",
        "is_root" : false
    },
    "0x7fd5bc05d900" : {
        "type" : "string",
        "size" : "37",
        "is_root" : false
    },
    "0x7fd5bc05c780" : {
        "type" : "object",
        "size" : "72",
        "is_root" : false,
        "class" : "stdClass",
        "object_handle" : "2",
        "children" : {
        }
    }
}

The 3 children strings are properly accounted for, but the declared string got the wrong item identifier, as well as the object.

Same PHP file executed with the PHP5 extension shows proper behavior:

"items": {
    "0x7f1acd2e4128" : {
        "type" : "object",
        "size" : "56",
        "symbol_name" : "myObject",
        "is_root" : true,
        "frame" : "<GLOBAL>",
        "class" : "MyClass",
        "object_handle" : "1",
        "children" : {
            "myDeclaredVar":"0x7f1acd2e60e8",
            "myUndeclaredVar":"0x7f1acd2e6118",
            "chilObject":"0x7f1acd2e5d48"
        }
    },
    "0x7f1acd2e60e8" : {
        "type" : "string",
        "size" : "47",
        "is_root" : false
    },
    "0x7f1acd2e6118" : {
        "type" : "string",
        "size" : "45",
        "is_root" : false
    },
    "0x7f1acd2e5d48" : {
        "type" : "object",
        "size" : "56",
        "is_root" : false,
        "class" : "stdClass",
        "object_handle" : "2",
        "children" : {
        }
    }
}
@BitOne BitOne closed this as completed in e18f762 Aug 13, 2018
BitOne added a commit that referenced this issue Aug 13, 2018
Fixes #76 on not maching children and item identifier
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

No branches or pull requests

1 participant