3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class C {} class D extends C {} $c = serialize(new C); $d = serialize(new D); var_dump(unserialize($c, ["allowed_classes" => ["C"]])); var_dump(unserialize($c, ["allowed_classes" => ["D"]])); var_dump(unserialize($d, ["allowed_classes" => ["C"]])); var_dump(unserialize($d, ["allowed_classes" => ["D"]]));
Output for 7.0.0 - 7.2.0
object(C)#1 (0) { } object(__PHP_Incomplete_Class)#1 (1) { ["__PHP_Incomplete_Class_Name"]=> string(1) "C" } object(__PHP_Incomplete_Class)#1 (1) { ["__PHP_Incomplete_Class_Name"]=> string(1) "D" } object(D)#1 (0) { }
Output for 5.4.2 - 5.6.28
Warning: unserialize() expects exactly 1 parameter, 2 given in /in/3HGAJ on line 9 bool(false) Warning: unserialize() expects exactly 1 parameter, 2 given in /in/3HGAJ on line 10 bool(false) Warning: unserialize() expects exactly 1 parameter, 2 given in /in/3HGAJ on line 11 bool(false) Warning: unserialize() expects exactly 1 parameter, 2 given in /in/3HGAJ on line 12 bool(false)
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/3HGAJ on line 9
Process exited with code 255.