Attempted to call an undefined method named "createDateTime" of class "Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler" · Issue #28195 · symfony/symfony · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempted to call an undefined method named "createDateTime" of class "Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler"
#28195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Description
A database (MongoDB) session storage was enabled as described in docs (http://symfony.com/doc/current/doctrine/mongodb_session_storage.html). It works. I can log in and it stores the session in the database. However, if you browse to a page where the session is used, following error is logged:
request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedMethodException: "Attempted to call an undefined method named "createDateTime" of class "Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler"." at /ebs/www/web_root/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php line 144 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\UndefinedMethodException(code: 0): Attempted to call an undefined method named \"createDateTime\" of class \"Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MongoDbSessionHandler\". at /ebs/www/web_root/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php:144)"} []
How to reproduce
Have a Symfony installation with MongoDB.
Have a simple login system with a user authenticator and provided.
Have a dummy page which is behind access control (so a session is required to access that page).
Configure it to store session in database.
Run the application in PROD mode.
Visit the page you created above.
500 error.
Check the application error log.
Possible Solution
Method updateTimestamp() uses $this->createDateTime() which appears to be not defined in the local class or the extended one. Method doWrite() attempts to work with time by using new \MongoDB\BSON\UTCDateTime() which is correct. updateTimestamp() should be changed to make use of \MongoDB\BSON\UTCDateTime().
Thanks.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 4.0.4
Description
A database (MongoDB) session storage was enabled as described in docs (http://symfony.com/doc/current/doctrine/mongodb_session_storage.html). It works. I can log in and it stores the session in the database. However, if you browse to a page where the session is used, following error is logged:
How to reproduce
Possible Solution
Method
updateTimestamp()
uses$this->createDateTime()
which appears to be not defined in the local class or the extended one. MethoddoWrite()
attempts to work with time by usingnew \MongoDB\BSON\UTCDateTime()
which is correct.updateTimestamp()
should be changed to make use of\MongoDB\BSON\UTCDateTime()
.Thanks.
The text was updated successfully, but these errors were encountered: