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 = 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
array(9) { [0]=> string(2) "21" [1]=> string(2) "{x" [2]=> string(1) "i" [3]=> string(3) "0;a" [4]=> string(1) "0" [5]=> string(4) "{};m" [6]=> string(1) "a" [7]=> string(1) "0" [8]=> string(3) "{}}" } object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 26 of 31 bytes in /in/WkqUm on line 23 bool(false)
Output for 5.6.8 - 5.6.20, 7.0.0 - 7.0.5
array(9) { [0]=> string(2) "21" [1]=> string(2) "{x" [2]=> string(1) "i" [3]=> string(3) "0;a" [4]=> string(1) "0" [5]=> string(4) "{};m" [6]=> string(1) "a" [7]=> string(1) "0" [8]=> string(3) "{}}" } object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(19) "CantUnserializeThis"
Output for 5.6.21 - 5.6.28
array(9) { [0]=> string(2) "21" [1]=> string(2) "{x" [2]=> string(1) "i" [3]=> string(3) "0;a" [4]=> string(1) "0" [5]=> string(4) "{};m" [6]=> string(1) "a" [7]=> string(1) "0" [8]=> string(3) "{}}" } object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 26 of 31 bytes in /in/WkqUm on line 25 bool(false)
Output for 5.4.14 - 5.5.35
array(9) { [0]=> string(2) "21" [1]=> string(2) "{x" [2]=> string(1) "i" [3]=> string(3) "0;a" [4]=> string(1) "0" [5]=> string(4) "{};m" [6]=> string(1) "a" [7]=> string(1) "0" [8]=> string(3) "{}}" } Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in /in/WkqUm:19 Stack trace: #0 [internal function]: ArrayObject->unserialize('') #1 /in/WkqUm(19): unserialize('C:19:"CantUnser...') #2 {main} thrown in /in/WkqUm on line 19
Process exited with code 255.
Output for 5.4.0 - 5.4.13
array(9) { [0]=> string(2) "21" [1]=> string(2) "{x" [2]=> string(1) "i" [3]=> string(3) "0;a" [4]=> string(1) "0" [5]=> string(4) "{};m" [6]=> string(1) "a" [7]=> string(1) "0" [8]=> string(3) "{}}" } Notice: unserialize(): Error at offset 30 of 31 bytes in /in/WkqUm on line 19 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in /in/WkqUm:19 Stack trace: #0 [internal function]: ArrayObject->unserialize('') #1 /in/WkqUm(19): unserialize('C:19:"CantUnser...') #2 {main} thrown in /in/WkqUm on line 19
Process exited with code 255.
Output for 5.3.3 - 5.3.29
array(9) { [0]=> string(2) "21" [1]=> string(2) "{x" [2]=> string(1) "i" [3]=> string(3) "0;a" [4]=> string(1) "0" [5]=> string(4) "{};m" [6]=> string(1) "a" [7]=> string(1) "0" [8]=> string(3) "{}}" } Notice: unserialize(): Error at offset 30 of 31 bytes in /in/WkqUm on line 19 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Error at offset 0 of 0 bytes' in /in/WkqUm:19 Stack trace: #0 /in/WkqUm(19): unserialize('C:19:"CantUnser...') #1 {main} thrown in /in/WkqUm on line 19
Process exited with code 255.
Output for 5.3.0 - 5.3.2
array(9) { [0]=> string(2) "21" [1]=> string(2) "{x" [2]=> string(1) "i" [3]=> string(3) "0;a" [4]=> string(1) "0" [5]=> string(4) "{};m" [6]=> string(1) "a" [7]=> string(1) "0" [8]=> string(3) "{}}" } Notice: unserialize(): Error at offset 30 of 31 bytes in /in/WkqUm on line 0 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Error at offset 0 of 0 bytes' in /in/WkqUm:19 Stack trace: #0 /in/WkqUm(19): unserialize('C:19:"CantUnser...') #1 {main} thrown in /in/WkqUm on line 19
Process exited with code 255.
Output for 5.2.1 - 5.2.17
array(2) { [0]=> string(1) "0" [1]=> string(2) "{}" } Warning: Class CantUnserializeThis has no unserializer in /in/WkqUm on line 19 Notice: unserialize(): Error at offset 25 of 31 bytes in /in/WkqUm on line 19 bool(false) string(19) "CantUnserializeThis"
Output for 5.1.0 - 5.2.0
array(2) { [0]=> string(1) "0" [1]=> string(2) "{}" } Warning: Class CantUnserializeThis has no unserializer in /in/WkqUm on line 19 Notice: unserialize(): Error at offset 25 of 31 bytes in /in/WkqUm on line 19 bool(false) Notice: unserialize(): Error at offset 0 of 31 bytes in /in/WkqUm on line 25 bool(false)
Output for 5.0.0 - 5.0.5
array(2) { [0]=> string(1) "0" [1]=> string(2) "{}" } Notice: unserialize(): Error at offset 0 of 31 bytes in /in/WkqUm on line 19 bool(false) Notice: unserialize(): Error at offset 0 of 31 bytes in /in/WkqUm 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/WkqUm 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/WkqUm on line 3