3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CantUnserializeThis extends ArrayObject { } $className = 'CantUnserializeThis'; $serialized = serialize(new ArrayObject()); $chunks = explode(':', $serialized); $serializedValuesChunk = array_slice(3, $chunks); 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 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: array_slice(): Argument #1 ($array) must be of type array, int given in /in/e21i3:11 Stack trace: #0 /in/e21i3(11): array_slice(3, Array) #1 {main} thrown in /in/e21i3 on line 11
Process exited with code 255.
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: array_slice() expects parameter 1 to be array, int given in /in/e21i3 on line 11 NULL object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 26 of 31 bytes in /in/e21i3 on line 24 bool(false)
Output for 7.3.32 - 7.3.33
Warning: array_slice() expects parameter 1 to be array, int given in /in/e21i3 on line 11 NULL object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } bool(false)
Output for 7.0.19 - 7.0.33, 7.1.5 - 7.1.33, 7.2.0 - 7.2.33
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 26 of 31 bytes in /in/e21i3 on line 24 bool(false)
Output for 7.0.6 - 7.0.18, 7.1.0 - 7.1.4
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 26 of 31 bytes in /in/e21i3 on line 23 bool(false)
Output for 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } string(19) "CantUnserializeThis"
Output for 5.6.21 - 5.6.40
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL object(CantUnserializeThis)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } Notice: unserialize(): Error at offset 26 of 31 bytes in /in/e21i3 on line 25 bool(false)
Output for 5.4.14 - 5.4.45, 5.5.0 - 5.5.38
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in /in/e21i3:19 Stack trace: #0 [internal function]: ArrayObject->unserialize('') #1 /in/e21i3(19): unserialize('C:19:"CantUnser...') #2 {main} thrown in /in/e21i3 on line 19
Process exited with code 255.
Output for 5.4.0 - 5.4.13
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL Notice: unserialize(): Error at offset 30 of 31 bytes in /in/e21i3 on line 19 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in /in/e21i3:19 Stack trace: #0 [internal function]: ArrayObject->unserialize('') #1 /in/e21i3(19): unserialize('C:19:"CantUnser...') #2 {main} thrown in /in/e21i3 on line 19
Process exited with code 255.
Output for 5.3.3 - 5.3.29
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL Notice: unserialize(): Error at offset 30 of 31 bytes in /in/e21i3 on line 19 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Error at offset 0 of 0 bytes' in /in/e21i3:19 Stack trace: #0 /in/e21i3(19): unserialize('C:19:"CantUnser...') #1 {main} thrown in /in/e21i3 on line 19
Process exited with code 255.
Output for 5.3.0 - 5.3.2
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL Notice: unserialize(): Error at offset 30 of 31 bytes in /in/e21i3 on line 0 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Error at offset 0 of 0 bytes' in /in/e21i3:19 Stack trace: #0 /in/e21i3(19): unserialize('C:19:"CantUnser...') #1 {main} thrown in /in/e21i3 on line 19
Process exited with code 255.
Output for 5.2.6 - 5.2.17
Warning: array_slice() expects parameter 1 to be array, integer given in /in/e21i3 on line 11 NULL Warning: Class CantUnserializeThis has no unserializer in /in/e21i3 on line 19 Notice: unserialize(): Error at offset 25 of 31 bytes in /in/e21i3 on line 19 bool(false) string(19) "CantUnserializeThis"
Output for 5.2.1 - 5.2.5
Warning: array_slice(): The first argument should be an array in /in/e21i3 on line 11 NULL Warning: Class CantUnserializeThis has no unserializer in /in/e21i3 on line 19 Notice: unserialize(): Error at offset 25 of 31 bytes in /in/e21i3 on line 19 bool(false) string(19) "CantUnserializeThis"
Output for 5.1.0 - 5.1.6, 5.2.0
Warning: array_slice(): The first argument should be an array in /in/e21i3 on line 11 NULL Warning: Class CantUnserializeThis has no unserializer in /in/e21i3 on line 19 Notice: unserialize(): Error at offset 25 of 31 bytes in /in/e21i3 on line 19 bool(false) Notice: unserialize(): Error at offset 0 of 31 bytes in /in/e21i3 on line 25 bool(false)
Output for 5.0.0 - 5.0.5
Warning: array_slice(): The first argument should be an array in /in/e21i3 on line 11 NULL Notice: unserialize(): Error at offset 0 of 31 bytes in /in/e21i3 on line 19 bool(false) Notice: unserialize(): Error at offset 0 of 31 bytes in /in/e21i3 on line 25 bool(false)
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Class cantunserializethis: Cannot inherit from undefined class arrayobject in /in/e21i3 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/e21i3 on line 3

preferences:
307.09 ms | 401 KiB | 461 Q