<?php
class C {
public $a = true;
public function __sleep() {
return 'ok';
}
}
$a = new C;
$s = serialize($a);
var_dump($s);
var_dump(unserialize($s));
Warning: serialize(): C::__sleep() should return an array only containing the names of instance-variables to serialize in /in/rm9rs on line 13
string(2) "N;"
NULL
Notice: serialize(): __sleep should return an array only containing the names of instance-variables to serialize in /in/rm9rs on line 13
string(2) "N;"
NULL
Notice: serialize(): __sleep should return an array only containing the names of instance-variables to serialize. in /in/rm9rs on line 13
string(2) "N;"
NULL
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/rm9rs 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/rm9rs 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/rm9rs on line 4
Process exited with code 255.