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.
0 Comments.