@ 2015-10-19T22:50:41Z <?php
class foo {
protected $bar;
}
class bar extends foo {
}
$test = new bar();
$meh = serialize($test);
$meh = unserialize($meh, ['allowed_classes' => 'foo']);
var_dump($meh);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught TypeError: unserialize(): Option "allowed_classes" must be of type array|bool, string given in /in/MNAsv:14
Stack trace:
#0 /in/MNAsv(14): unserialize('O:3:"bar":1:{s:...', Array)
#1 {main}
thrown in /in/MNAsv on line 14
Process exited with code 255 . Output for 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Warning: unserialize(): allowed_classes option should be array or boolean in /in/MNAsv on line 14
bool(false)
Output for 7.0.0 - 7.0.33 object(bar)#2 (1) {
["bar":protected]=>
NULL
}
Output for 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 Warning: unserialize() expects exactly 1 parameter, 2 given in /in/MNAsv on line 14
bool(false)
preferences:dark mode live preview
271.71 ms | 402 KiB | 376 Q