3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $class = "ArrayObject"; // we break BC here var_dump(unserialize('O:'.strlen($class).':"'.$class.'":0:{}')); // we still allow segfault: class MySplFileObject extends SplFileObject{} $class = "MySplFileObject"; var_dump(unserialize('O:'.strlen($class).':"'.$class.'":0:{}'));
Output for 5.4.29, 5.5.13, 5.6.0 - 7.2.0
Warning: Erroneous data format for unserializing 'ArrayObject' in /in/BDq6g on line 4 Notice: unserialize(): Error at offset 22 of 23 bytes in /in/BDq6g on line 4 bool(false) Warning: Erroneous data format for unserializing 'MySplFileObject' in /in/BDq6g on line 8 Notice: unserialize(): Error at offset 26 of 27 bytes in /in/BDq6g on line 8 bool(false)
Output for 5.4.30 - 5.4.45, 5.5.14 - 5.5.36
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Warning: Erroneous data format for unserializing 'MySplFileObject' in /in/BDq6g on line 8 Notice: unserialize(): Error at offset 26 of 27 bytes in /in/BDq6g on line 8 bool(false)
Output for 5.3.0 - 5.4.28, 5.5.0 - 5.5.12
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } object(MySplFileObject)#1 (1) { ["pathName":"SplFileInfo":private]=> string(0) "" }
Output for 5.1.0 - 5.2.17
object(ArrayObject)#1 (0) { } object(MySplFileObject)#1 (0) { }
Output for 5.0.0 - 5.0.5
object(ArrayObject)#1 (0) { } Fatal error: Class 'SplFileObject' not found in /in/BDq6g on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
object(__PHP_Incomplete_Class)(1) { ["__PHP_Incomplete_Class_Name"]=> string(11) "arrayobject" } Fatal error: Class mysplfileobject: Cannot inherit from undefined class splfileobject in /in/BDq6g on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
object(__PHP_Incomplete_Class)(1) { ["__PHP_Incomplete_Class_Name"]=> string(11) "arrayobject" } Fatal error: Class mysplfileobject: Cannot inherit from undefined class splfileobject in /in/BDq6g on line 6