The __sleep() serialization magic method has been deprecated.
Description
Class serialization in PHP has had multiple mechanism introduced to control its behaviour by userland. Initially with the __sleep() and __wakeup() magic methods, then with the Serializable interface and finally with __serialize() and __unserialize().
In the end, the __serialize and __unserialize methods must be used, instead of __sleep and __wakeup.
Example
<?php
class X {
function __sleep() {}
}
?>
Alternatives
- Rename the method to
__serialize.
Related error messages
Related error messages
Changed Behavior
This error may appear following an evolution in behavior, in previous versions. See