3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeCollection extends ArrayObject {} $meh = unserialize('O:14:"SomeCollection":1:{i:0;s:4:"item";}'); var_dump('yay', $meh); var_dump($meh[0]); $meh = unserialize('C:14:"SomeCollection":36:{x:i:0;a:1:{i:0;s:4:"item";};m:a:0:{}}'); var_dump('yay', $meh);
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught UnexpectedValueException: Incomplete or ill-typed serialization data in /in/SpJvE:6 Stack trace: #0 [internal function]: ArrayObject->__unserialize(Array) #1 /in/SpJvE(6): unserialize('O:14:"SomeColle...') #2 {main} thrown in /in/SpJvE on line 6
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: Erroneous data format for unserializing 'SomeCollection' in /in/SpJvE on line 6 string(3) "yay" bool(false) NULL string(3) "yay" object(SomeCollection)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } }
Output for 5.4.29, 5.5.13, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.31
Warning: Erroneous data format for unserializing 'SomeCollection' in /in/SpJvE on line 6 Notice: unserialize(): Error at offset 25 of 41 bytes in /in/SpJvE on line 6 string(3) "yay" bool(false) NULL string(3) "yay" object(SomeCollection)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } }
Output for 5.4.8 - 5.4.28, 5.4.30 - 5.4.45, 5.5.0 - 5.5.12, 5.5.14 - 5.5.38
string(3) "yay" object(SomeCollection)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { ["0"]=> string(4) "item" } } Notice: Undefined offset: 0 in /in/SpJvE on line 8 NULL string(3) "yay" object(SomeCollection)#2 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } }
Output for 5.3.9 - 5.3.29, 5.4.0 - 5.4.7
string(3) "yay" object(SomeCollection)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { ["0"]=> string(4) "item" } } Notice: Undefined offset: 0 in /in/SpJvE on line 8 NULL string(3) "yay" object(SomeCollection)#2 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } }
Output for 5.3.0 - 5.3.8
string(3) "yay" object(SomeCollection)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } } string(4) "item" string(3) "yay" object(SomeCollection)#2 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } }
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
string(3) "yay" object(SomeCollection)#1 (1) { [0]=> string(4) "item" } string(4) "item" Warning: Class SomeCollection has no unserializer in /in/SpJvE on line 9 Notice: unserialize(): Error at offset 20 of 63 bytes in /in/SpJvE on line 9 string(3) "yay" bool(false)
Output for 5.0.0 - 5.0.5
string(3) "yay" object(SomeCollection)#1 (1) { [0]=> string(4) "item" } string(4) "item" Notice: unserialize(): Error at offset 0 of 63 bytes in /in/SpJvE on line 9 string(3) "yay" bool(false)
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Class somecollection: Cannot inherit from undefined class arrayobject in /in/SpJvE on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Class somecollection: Cannot inherit from undefined class arrayobject in /in/SpJvE on line 3

preferences:
235.64 ms | 401 KiB | 357 Q