3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { protected $bar; } class bar extends foo { } $test = new bar(); $meh = serialize($test); $meh = unserialize($meh, ['allowed_classes' => 'foo']); var_dump($meh);
based on KN2me
Output for 7.1.0 - 7.2.0
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.20
object(bar)#2 (1) { ["bar":protected]=> NULL }
Output for 5.4.0 - 5.6.28
Warning: unserialize() expects exactly 1 parameter, 2 given in /in/MNAsv on line 14 bool(false)
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/MNAsv on line 14
Process exited with code 255.