Skip to content

[HttpFoundation] Custom session save handlers are ignored #9351

Closed
@myurasov

Description

@myurasov

The following code saved sessions to MongoDB in Symfony 2.2, but now (looks like starting with version 2.3) doesn't work - sessions are stored in filesystem.

In other words - if I downgrade to Symfony HttpFoundation 2.2 - everything works, when I go to 2.3 - it breaks.

use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler;

// ...

$sessionHandler = new MongoDbSessionHandler(
  new \MongoClient("mongodb://localhost:27017"), [
    "database" => "MyDatabase",
    "collection" => "sessions"
  ]
);

session_set_save_handler(
  array($sessionHandler, "open"),
  array($sessionHandler, "close"),
  array($sessionHandler, "read"),
  array($sessionHandler, "write"),
  array($sessionHandler, "destroy"),
  array($sessionHandler, "gc")
);

// ...

$session = new Session();
$session->set('something', 'abc');

Note that session is NOT started by legacy php code elsewhere.

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy