Solved thread. This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.
![]() ![]()
This entry was posted in on byI’m using ZendAuth on a Zend Framework project and while working through an example where an object was written to the session using ZendAuth ‘s getStorage-write method, I was given the following error:“You cannot serialize or unserialize PDO instances”ZendAuth serializes arrays and objects when writing them to storage. Many built in PHP objects cannot be serialized, such as PDO. PHP’s serialize method will call the sleep method of the object you’re serializing prior to serialization, giving you the ability to clean up anything in the object that may cause problems (such as an object of PDO).The solution was to implement the magic method sleep in my object and return an array of the properties I wanted it to serialize like.
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |