Symfony2 – ErrorException: Notice: serialize() [function.serialize]: “xxx” returned as member variable from __sleep() but does not exist in …

While storing an entity from Doctrine2 in the session under a Symfony2 application I got this error:

ErrorException: Notice: serialize() [function.serialize]: "entity_property" returned as member variable from __sleep() but does not exist in ...vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php line 27

This error was happening because my “entity_property” was declared as private and PHP has some issues serializing objects that subclass a class with private properties. Just changing that “entity_property” to protected (as it should always have been…) solver the error.

Ref: http://blog.geertvd.be/2011/09/25/symfony2-id-returned-as-member-variable-from-__sleep-but-does-not-exist

You might also like

Fix “Cannot redeclare class Symfony\…” in Symfony2 after upgrade
After upgrading from Symfony 2.2 to 2.3 I got this error in my application: Fatal error: Cannot redeclare...
Expose config.yml values globally for Twig templates in Symfony2 applications
Lets suppose you have created a bundle that has some specific configuration in the config.yml file (this...
Solve “mongodb cannot be built while v8 is active” in MacPorts
While updating all the ports of macports I got this error: ---> Configuring mongodb Error: mongodb...
Increase the phpMyAdmin session timeout
Edit your config.inc.php file (in my Ubuntu 12.04 it was located at /etc/phpmyadmin/config.inc.php) and...
Leave a comment ?

0 Comments.

Leave a Comment