Skip to content

Children items not properly linked in PHP 7 #76

@BitOne

Description

@BitOne

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" : {
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions