<?php
$obj = new ArrayObject;var_dump($obj);var_dump(serialize($obj));class MyArrayObject extends ArrayObject{public function __construct(){} public function serialize(){return "";} public function unserialize($data){echo 123;exit;}};$myObj = new MyArrayObject;var_dump($myObj);var_dump(serialize($myObj));$myUnserObj = unserialize("O:13:\"MyArrayObject\":0:{}");var_dump($myUnserObj);$myUnserObj->append(123);var_dump($myUnserObj);
Deprecated: Return type of MyArrayObject::unserialize($data) should either be compatible with ArrayObject::unserialize(string $data): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rT5pJ on line 3
Deprecated: Return type of MyArrayObject::serialize() should either be compatible with ArrayObject::serialize(): string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rT5pJ on line 3
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(57) "O:11:"ArrayObject":4:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}i:3;N;}"
object(MyArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(59) "O:13:"MyArrayObject":4:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}i:3;N;}"
Fatal error: Uncaught UnexpectedValueException: Incomplete or ill-typed serialization data in /in/rT5pJ:3
Stack trace:
#0 [internal function]: ArrayObject->__unserialize(Array)
#1 /in/rT5pJ(3): unserialize('O:13:"MyArrayOb...')
#2 {main}
thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.4.6 - 7.4.33, 8.0.0 - 8.0.30
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(57) "O:11:"ArrayObject":4:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}i:3;N;}"
object(MyArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(59) "O:13:"MyArrayObject":4:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}i:3;N;}"
Fatal error: Uncaught UnexpectedValueException: Incomplete or ill-typed serialization data in /in/rT5pJ:3
Stack trace:
#0 [internal function]: ArrayObject->__unserialize(Array)
#1 /in/rT5pJ(3): unserialize('O:13:"MyArrayOb...')
#2 {main}
thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.4.0 - 7.4.5
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(51) "O:11:"ArrayObject":3:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}}"
object(MyArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(53) "O:13:"MyArrayObject":3:{i:0;i:0;i:1;a:0:{}i:2;a:0:{}}"
Fatal error: Uncaught UnexpectedValueException: Incomplete or ill-typed serialization data in /in/rT5pJ:3
Stack trace:
#0 [internal function]: ArrayObject->__unserialize(Array)
#1 /in/rT5pJ(3): unserialize('O:13:"MyArrayOb...')
#2 {main}
thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.3.32 - 7.3.33
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}"
object(MyArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(25) "C:13:"MyArrayObject":0:{}"
Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3
bool(false)
Fatal error: Uncaught Error: Call to a member function append() on bool in /in/rT5pJ:3
Stack trace:
#0 {main}
thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 7.3.0 - 7.3.31
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}"
object(MyArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(25) "C:13:"MyArrayObject":0:{}"
Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3
Notice: unserialize(): Error at offset 24 of 25 bytes in /in/rT5pJ on line 3
bool(false)
Fatal error: Uncaught Error: Call to a member function append() on bool in /in/rT5pJ:3
Stack trace:
#0 {main}
thrown in /in/rT5pJ on line 3
Process exited with code 255.
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}"
object(MyArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(25) "C:13:"MyArrayObject":0:{}"
Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3
Notice: unserialize(): Error at offset 24 of 25 bytes in /in/rT5pJ on line 3
bool(false)
Fatal error: Uncaught Error: Call to a member function append() on boolean in /in/rT5pJ:3
Stack trace:
#0 {main}
thrown in /in/rT5pJ on line 3
Process exited with code 255.
Output for 5.6.7 - 5.6.28
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}"
object(MyArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(25) "C:13:"MyArrayObject":0:{}"
Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3
Notice: unserialize(): Error at offset 24 of 25 bytes in /in/rT5pJ on line 3
bool(false)
Fatal error: Call to a member function append() on boolean in /in/rT5pJ on line 3
Process exited with code 255.
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}"
object(MyArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
string(25) "C:13:"MyArrayObject":0:{}"
Warning: Erroneous data format for unserializing 'MyArrayObject' in /in/rT5pJ on line 3
Notice: unserialize(): Error at offset 24 of 25 bytes in /in/rT5pJ on line 3
bool(false)
Fatal error: Call to a member function append() on a non-object in /in/rT5pJ on line 3
Process exited with code 255.
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/rT5pJ on line 3
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/rT5pJ on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/rT5pJ on line 3
Process exited with code 255.