<?php
class C {
public $a = true;
public function __sleep() {
return ['a', '1'];
}
}
$a = new C;
$s = serialize($a);
var_dump($s);
var_dump(unserialize($s));
Warning: serialize(): "1" returned as member variable from __sleep() but does not exist in /in/kupOg on line 13
string(24) "O:1:"C":1:{s:1:"a";b:1;}"
object(C)#2 (1) {
["a"]=>
bool(true)
}
Notice: serialize(): "1" returned as member variable from __sleep() but does not exist in /in/kupOg on line 13
string(34) "O:1:"C":2:{s:1:"a";b:1;s:1:"1";N;}"
object(C)#2 (2) {
["a"]=>
bool(true)
["1"]=>
NULL
}
Parse error: syntax error, unexpected '[' in /in/kupOg on line 7
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/kupOg on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/kupOg on line 4
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/kupOg on line 4
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/kupOg on line 4
Process exited with code 255.