3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class CantUnserializeThis extends ArrayObject { } $className = 'CantUnserializeThis'; $serialized = serialize(new ArrayObject()); $chunks = explode(':', $serialized); $serializedValuesChunk = implode(':', array_slice($chunks, 3)); var_dump($serializedValuesChunk); var_dump(unserialize(sprintf( 'C:%d:"%s":0:{}', strlen($className), $className ))); var_dump(unserialize(sprintf( 'S:%d:"%s":0:{}', strlen($className), $className )));
Output for 7.0.6 - 7.1.0
string(26) "21:{x:i:0;a:0:{};m:a:0:{}}" object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 26 of 31 bytes in /in/MPGsh on line 23 bool(false)
Output for 5.6.8 - 5.6.20, 7.0.0 - 7.0.5
string(26) "21:{x:i:0;a:0:{};m:a:0:{}}" object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(19) "CantUnserializeThis"
Output for 5.6.21
string(26) "21:{x:i:0;a:0:{};m:a:0:{}}" object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 26 of 31 bytes in /in/MPGsh on line 25 bool(false)
Output for 5.4.14 - 5.5.35
string(26) "21:{x:i:0;a:0:{};m:a:0:{}}" Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in /in/MPGsh:19 Stack trace: #0 [internal function]: ArrayObject->unserialize('') #1 /in/MPGsh(19): unserialize('C:19:"CantUnser...') #2 {main} thrown in /in/MPGsh on line 19
Process exited with code 255.
Output for 5.4.0 - 5.4.13
string(26) "21:{x:i:0;a:0:{};m:a:0:{}}" Notice: unserialize(): Error at offset 30 of 31 bytes in /in/MPGsh on line 19 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in /in/MPGsh:19 Stack trace: #0 [internal function]: ArrayObject->unserialize('') #1 /in/MPGsh(19): unserialize('C:19:"CantUnser...') #2 {main} thrown in /in/MPGsh on line 19
Process exited with code 255.
Output for 5.3.3 - 5.3.29
string(26) "21:{x:i:0;a:0:{};m:a:0:{}}" Notice: unserialize(): Error at offset 30 of 31 bytes in /in/MPGsh on line 19 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Error at offset 0 of 0 bytes' in /in/MPGsh:19 Stack trace: #0 /in/MPGsh(19): unserialize('C:19:"CantUnser...') #1 {main} thrown in /in/MPGsh on line 19
Process exited with code 255.
Output for 5.3.0 - 5.3.2
string(26) "21:{x:i:0;a:0:{};m:a:0:{}}" Notice: unserialize(): Error at offset 30 of 31 bytes in /in/MPGsh on line 0 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Error at offset 0 of 0 bytes' in /in/MPGsh:19 Stack trace: #0 /in/MPGsh(19): unserialize('C:19:"CantUnser...') #1 {main} thrown in /in/MPGsh on line 19
Process exited with code 255.
Output for 5.2.1 - 5.2.17
string(4) "0:{}" Warning: Class CantUnserializeThis has no unserializer in /in/MPGsh on line 19 Notice: unserialize(): Error at offset 25 of 31 bytes in /in/MPGsh on line 19 bool(false) string(19) "CantUnserializeThis"
Output for 5.1.0 - 5.2.0
string(4) "0:{}" Warning: Class CantUnserializeThis has no unserializer in /in/MPGsh on line 19 Notice: unserialize(): Error at offset 25 of 31 bytes in /in/MPGsh on line 19 bool(false) Notice: unserialize(): Error at offset 0 of 31 bytes in /in/MPGsh on line 25 bool(false)
Output for 5.0.0 - 5.0.5
string(4) "0:{}" Notice: unserialize(): Error at offset 0 of 31 bytes in /in/MPGsh on line 19 bool(false) Notice: unserialize(): Error at offset 0 of 31 bytes in /in/MPGsh on line 25 bool(false)
Output for 4.3.2 - 4.4.9
Fatal error: Class cantunserializethis: Cannot inherit from undefined class arrayobject in /in/MPGsh 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/MPGsh on line 3