BitOne / php-meminfo

PHP extension to get insight about memory usage
MIT License
1.08k stars 78 forks source link

Wrong frame name for PHP 7 #67

Closed BitOne closed 6 years ago

BitOne commented 6 years ago

With the following code::

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

function test() {
    $a = "test";
    meminfo_dump(fopen('php://stdout', 'w'));
}   

test();

When executed with the PHP 7 version of the extension provides the following result:

{
"items": {
    "0x7f347ea57180" : {
        "type" : "unknown",
        "size" : "16",
        "symbol_name" : "argv",
        "is_root" : true,
        "frame" : "test()"
    },
    "0x7f347ea571a0" : {
        "type" : "unknown",
        "size" : "16",
        "symbol_name" : "argc",
        "is_root" : true,
        "frame" : "test()"
  }
}

The a variable is not present and the argv and argc variables are defined at the wrong frame.

Comparing to the execution with the PHP 5 version of the extension:

{
  "items": {
    "0x7fc6ca961158" : {
        "type" : "string",
        "size" : "28",
        "symbol_name" : "a",
        "is_root" : true,
        "frame" : "test()"
    }
}
BitOne commented 6 years ago

Fixed by #62

BitOne commented 6 years ago

Still need some test.

BitOne commented 6 years ago

Tests added by #69