Hello fellow devs, I use a custom authentication adapter to authenticate. The authenticate() method returns a Zend\Authentication\Result object with my cutsom user object in it. As long as the user object was created with `new User()` this worked pretty fine. The user is stored in the session, which is being stored in the DB.
Now I changed my User class to implement ServiceManagerAwareInterface in order to be able to access the service manager within my model. In order for this to work, I cannot instantiate my user object with `new User()` but instead with $this->sm->get('My\Model\User'). I created the associated invokable first. Since I changed that, the user cannot be stored by the SessionManager anymore. I get an exception: 'Exception' with message 'Serialization of 'Closure' is not allowed' in /vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject.php:323 Stack trace: #0 /vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject.php(0): serialize() #1 [internal function]: Zend\Stdlib\ArrayObject->serialize() #2 /vendor/zendframework/zendframew in <b>/vendor/zendframework/zendframework/library/Zend/Session/SessionManager.php</b> on line <b>166</b><br /> I use ZF 2.1 Do you have any idea why this is and how to fix it? Any help would be highly appreciated. Regards Rob