Ralf,

On 09.12.2012 14:37, Ralf Eggert wrote:
> Fatal error: Uncaught exception 'PDOException' with message 'You cannot
> serialize or unserialize PDOStatement instances' in
>
/home/devhost/zf2-buch-listings/zf2-buch-chapter11/vendor/zendframework/zendframework/library/Zend/Serializer/Adapter/PhpSerialize.php:54
>
> Stack trace:
>
> #0 [internal function]: PDOStatement->__sleep()
> #1
>
/home/devhost/zf2-buch-listings/zf2-buch-chapter11/vendor/zendframework/zendframework/library/Zend/Serializer/Adapter/PhpSerialize.php(54):
> serialize(Object(Zend\Db\ResultSet\ResultSet))
> #2
>
/home/devhost/zf2-buch-listings/zf2-buch-chapter11/vendor/zendframework/zendframework/library/Zend/Cache/Storage/Plugin/Serializer.php(156):
>
Zend\Serializer\Adapter\PhpSerialize->serialize(Object(Zend\Db\ResultSet\ResultSet))
> #3 [internal function]:
>
Zend\Cache\Storage\Plugin\Serializer->onWriteItemPre(Object(Zend\Cache\Storage\Event))
> #4
>
/home/devhost/zf2-buch-listings/zf2-buch-chapter11/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(464):
> call_user_func(Array, Object(Zend\Cache\Storag in
>
/home/devhost/zf2-buch-listings/zf2-buch-chapter11/vendor/zendframework/zendframework/library/Zend/Serializer/Adapter/PhpSerialize.php
> on line 54
> ========================================================================
>
> I could not get any previus exceptions.
The previous exception should be on your "Error writing files"

>
> Actually Zend\Paginator is trying to cache a Zend\Db\ResultSet\ResultSet
> instance which has a reference to a PDOStatement object.
Yes, thats the issue -> The Paginator is working on an object given by
the adapter and the DbSelect adapter returns a object of ResultSet which
is a stream resource (using PDOStatement in your case) and resources are
not cacheable / serializable.

To make it cacheable the stream needs to be completely read and only the
read data have to be handled by the paginator.
-> This could be done by Zend\Paginator\Adapter\DbSelect::getItems
but it could break BC and generate side effects.

I'm trying to discuss this @ IRC first.


-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to