%s::__sleep() should return an array only containing the names of instance-variables to serialize¶
Description¶
The return type of __sleep
is actually array
, even when it is not mentionned. Any other returned value generate this error.
Example¶
<?php
class X {
function __sleep() {
return 1;
}
}
serialize(new X);
?>
Solutions¶
Return an array from __sleep.
Add the return type
array
and return an array from __sleep.Remove the __sleep() method.