Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Attempted to call an undefined method named "createDateTime" of class "Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler" #28195

Copy link
Copy link
Closed
@mranawake

Description

@mranawake
Issue body actions

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.