3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class CantUnserializeThis extends ArrayObject { } $className = 'CantUnserializeThis'; $reflection = new ReflectionClass($className); $serialized = serialize(new ArrayObject()); $chunks = explode(':', $serialized); $serializedValuesChunks = implode(':', array_slice($chunks, 3)); var_dump(unserialize(sprintf( 'C:%d:"%s":%s', strlen($className), $className, $serializedValuesChunks ))); var_dump(unserialize(sprintf( 'O:%d:"%s":%s', strlen($className), $className, $serializedValuesChunks ))); var_dump($reflection->newInstanceWithoutConstructor());
Output for 7.0.0 - 7.1.0
object(CantUnserializeThis)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Warning: Erroneous data format for unserializing 'CantUnserializeThis' in /in/oSPvF on line 22 Notice: unserialize(): Error at offset 31 of 53 bytes in /in/oSPvF on line 22 bool(false) object(CantUnserializeThis)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } }
Output for 5.6.0 - 5.6.25
object(CantUnserializeThis)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Warning: Erroneous data format for unserializing 'CantUnserializeThis' in /in/oSPvF on line 25 Notice: unserialize(): Error at offset 31 of 53 bytes in /in/oSPvF on line 25 bool(false) object(CantUnserializeThis)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } }
Output for 5.4.0 - 5.4.28, 5.4.30 - 5.5.12, 5.5.14 - 5.5.38
object(CantUnserializeThis)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 31 of 53 bytes in /in/oSPvF on line 25 bool(false) Fatal error: Uncaught exception 'ReflectionException' with message 'Class CantUnserializeThis is an internal class that cannot be instantiated without invoking its constructor' in /in/oSPvF:27 Stack trace: #0 /in/oSPvF(27): ReflectionClass->newInstanceWithoutConstructor() #1 {main} thrown in /in/oSPvF on line 27
Process exited with code 255.
Output for 5.4.29, 5.5.13
object(CantUnserializeThis)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Warning: Erroneous data format for unserializing 'CantUnserializeThis' in /in/oSPvF on line 25 Notice: unserialize(): Error at offset 31 of 53 bytes in /in/oSPvF on line 25 bool(false) Fatal error: Uncaught exception 'ReflectionException' with message 'Class CantUnserializeThis is an internal class that cannot be instantiated without invoking its constructor' in /in/oSPvF:27 Stack trace: #0 /in/oSPvF(27): ReflectionClass->newInstanceWithoutConstructor() #1 {main} thrown in /in/oSPvF on line 27
Process exited with code 255.
Output for 5.3.0 - 5.3.29
object(CantUnserializeThis)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 31 of 53 bytes in /in/oSPvF on line 25 bool(false) Fatal error: Call to undefined method ReflectionClass::newInstanceWithoutConstructor() in /in/oSPvF on line 27
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Warning: Class CantUnserializeThis has no unserializer in /in/oSPvF on line 18 Notice: unserialize(): Error at offset 25 of 31 bytes in /in/oSPvF on line 18 bool(false) object(CantUnserializeThis)#2 (0) { } Fatal error: Call to undefined method ReflectionClass::newInstanceWithoutConstructor() in /in/oSPvF on line 27
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Notice: unserialize(): Error at offset 0 of 31 bytes in /in/oSPvF on line 18 bool(false) object(CantUnserializeThis)#2 (0) { } Fatal error: Call to undefined method ReflectionClass::newInstanceWithoutConstructor() in /in/oSPvF on line 27
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Class cantunserializethis: Cannot inherit from undefined class arrayobject in /in/oSPvF on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Class cantunserializethis: Cannot inherit from undefined class arrayobject in /in/oSPvF on line 3