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

Issue Type: Bug Created: 2008-03-10T20:43:27.000+0000 Last Updated: 2009-01-10T11:30:47.000+0000 Status: Closed Fix version(s): - 1.7.3 (19/Jan/09)

Reporter: C Snover (snover) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Select

Related issues: - ZF-2542



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:

<pre class="highlight">
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.)


Posted by Wil Sinclair (wil) on 2008-03-25T21:27:17.000+0000

Please categorize/fix as needed.

Posted by julien PAULI (doctorrock83) on 2008-07-24T01:06:12.000+0000

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 ?

Posted by Wil Sinclair (wil) on 2009-01-06T10:49:30.000+0000

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

Posted by Ralph Schindler (ralph) on 2009-01-10T11:30:47.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.