Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Failure to assign ref to typed property --FILE-- <?php class Test { public i..

Decoded Output download

--TEST--
Failure to assign ref to typed property
--FILE--
<?php

class Test {
    public int $prop;
}

$s = <<<'STR'
O:4:"Test":1:{s:4:"prop";O:8:"stdClass":1:{s:1:"y";R:2;}}
STR;
try {
    var_dump(unserialize($s));
} catch (Error $e) {
    echo $e->getMessage(), "
";
}

$s = <<<'STR'
O:4:"Test":1:{s:4:"prop";a:1:{i:0;R:2;
STR;
var_dump(unserialize($s));

?>
--EXPECTF--
Cannot assign stdClass to property Test::$prop of type int

Notice: unserialize(): Error at offset 38 of 38 bytes in %s on line %d
bool(false)

Did this file decode correctly?

Original Code

--TEST--
Failure to assign ref to typed property
--FILE--
<?php

class Test {
    public int $prop;
}

$s = <<<'STR'
O:4:"Test":1:{s:4:"prop";O:8:"stdClass":1:{s:1:"y";R:2;}}
STR;
try {
    var_dump(unserialize($s));
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

$s = <<<'STR'
O:4:"Test":1:{s:4:"prop";a:1:{i:0;R:2;
STR;
var_dump(unserialize($s));

?>
--EXPECTF--
Cannot assign stdClass to property Test::$prop of type int

Notice: unserialize(): Error at offset 38 of 38 bytes in %s on line %d
bool(false)

Function Calls

None

Variables

None

Stats

MD5 8aee524e0d021882793f719b3663fda0
Eval Count 0
Decode Time 97 ms