ZF-2854: Serialising Zend_Db_Select object leads to failure when unserializing


When a Zend_Db_Select object is serialised (eg. into a Session), on the next page load when Session_Start occurs and objects are woken up, PHP throws a fatal error:

Fatal error: Uncaught exception 'PDOException' with message 'You cannot serialize or unserialize PDO instances' in /export/lib/Zend/Session.php:380
Stack trace:
#0 [internal function]: PDO->__wakeup()
#1 /export/lib/Zend/Session.php(380): session_start()

This is because the attached Zend_Db_Adapter instance is not removed when the Zend_Db_Select object is serialised. (Why it doesn't fail until it attempts to be unserialised, I do not know.)


Please categorize/fix as needed.

I think a similar system as Zend_Db_Table_Row_Abstract should be implemented to allow Zend_Db_Select to be serialized (sessioned), with __sleep(). The object should get reconnected just after unserializing, like Zend_Db_Table_Rows do.

What dou you think about that ?

No action on this issue for too long. I'm reassigning to Ralph for re-evaluation and categorization.

Im fairly sure this was fixed in ZF-4600, please confirm, if not, please reopen