PDO exception at login submission
- paolo
- Member | 15
I have aproblem with login.
When I submit the login form I get a PDO exception:
You cannot serialize or unserialize PDO instances.
If I don't delete the session cookie not only my application, but all Nette examples fail to work and show an error page with the same exception (generated by session_start() call).
These are the last calls (as showed by the debug page, but in reverse order):
UserAccessPresenter.php:
Nette/Security/User.php:
Nette/Http/UserStorage.php
Nette/Http/Session.php:
inner-code PDO→ __sleep ()
- paolo
- Member | 15
Solved!
In the Authenticator class, I passed to the Identity constructor an instance of
GroupedSelection (returned by the related() method of class ActiveRow) instead
of an array.
Being not particularly expert of PHP, I thought that, because GroupedSelection
implements the interface ArrayAccess, could also be converted in array by cast
(used in Identity constructor). In fact it was converted, but not the way
I expected. The conversion was performed as for any other class, including all
class members, among which there must be some references to PDO objects.
Being such Identity included in the session store, it is subject to
serialization/unserialization, and this is the reason of the exception.
I hope this could help someone else with similar problems.