3v4l.org

run code in 150+ 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 - 5.6.28, 7.0.0 - 7.1.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 hhvm-3.10.0 - 3.12.0
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } object(MySplFileObject)#1 (12) { ["delimiter":"SplFileObject":private]=> string(1) "," ["enclosure":"SplFileObject":private]=> string(1) """ ["escape":"SplFileObject":private]=> string(1) "\" ["flags":"SplFileObject":private]=> NULL ["filename":"SplFileObject":private]=> NULL ["maxLineLen":"SplFileObject":private]=> int(0) ["currentLineNum":"SplFileObject":private]=> int(0) ["rsrc":"SplFileObject":private]=> NULL ["currentLine":"SplFileObject":private]=> bool(false) ["fileName":"SplFileInfo":private]=> NULL ["fileClass":"SplFileInfo":private]=> string(13) "SplFileObject" ["infoClass":"SplFileInfo":private]=> string(11) "SplFileInfo" }
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