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

Duplication of scalar with multiple references on PHP7 #70

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

Duplication of scalar with multiple references on PHP7 #70

BitOne opened this issue Aug 7, 2018 · 0 comments
Labels

Comments

@BitOne
Copy link
Owner

BitOne commented Aug 7, 2018

With the following code:

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

$a = "test";

$b =& $a;

$c = strlen($b);

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

With PHP7, wrong output: b shouldn't be there, as it's a reference to a. And a has type unknown.

"items": {
    "0x7fb93bc571e0" : {
        "type" : "unknown",
        "size" : "16",
        "symbol_name" : "a",
        "is_root" : true,
        "frame" : "<GLOBAL>"
    },
    "0x7fb93bc57200" : {
        "type" : "unknown",
        "size" : "16",
        "symbol_name" : "b",
        "is_root" : true,
        "frame" : "<GLOBAL>"
    },
    "0x7fb93bc57220" : {
        "type" : "integer",
        "size" : "16",
        "symbol_name" : "c",
        "is_root" : true,
        "frame" : "<GLOBAL>"
    }
}

With PHP5, the output is correct:

{
"items": {
    "0x7f96977ad158" : {
        "type" : "string",
        "size" : "28",
        "symbol_name" : "a",
        "is_root" : true,
        "frame" : "<GLOBAL>"
    },
    "0x7f96977ad0f8" : {
        "type" : "integer",
        "size" : "24",
        "symbol_name" : "c",
        "is_root" : true,
        "frame" : "<GLOBAL>"
    }
}
@BitOne BitOne added the bug label Aug 8, 2018
@BitOne BitOne closed this as completed in 7b7ce54 Aug 8, 2018
BitOne added a commit that referenced this issue Aug 8, 2018
…lar_php7

Fixes #70 by indirecting before dereferecing zval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant