Framework: Unable to destroy session using NullSessionHandler

Created on 5 Dec 2017  路  3Comments  路  Source: laravel/framework

  • Laravel version: 5.5.23
  • PHP version: 7.1.6

Description

A change was recently introduced to Symfony that makes NullSessionHandler extend AbstractSessionHandler (see https://github.com/symfony/symfony/commit/347939c9b3202ec55fcfa545bfdefd18e414789f#diff-da5c62baf91ad50fb6347f8027c1faa0L19)

On line 487 of Illuminate\Session\Store, destroy is called on the given handler. Because NullSessionHandler now extends AbstractSessionHandler, destroy fails when the handler does not have a name set (see https://github.com/symfony/symfony/blob/3ce9c29ae44692555d15983c7537187f5566e9ce/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php#L121)

testing.ERROR: Session name cannot be empty, did you forget to call "parent::open()" in "Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler"?

Here's where the problematic instance of NullSessionHandler is initialised: https://github.com/laravel/framework/blob/09126e4f39d1c28b2e0499491066c32e1bd9107f/src/Illuminate/Session/SessionManager.php#L28

It seems like the only way to set a name on the NullSessionHandler is to call open() on the instance after it has been created, which is not currently happening.

Steps to reproduce

$handler = new Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;

$handler->destroy(123);

Most helpful comment

@acarpio89 - please check the PR I've done. Should solve the issue.

All 3 comments

@acarpio89 - please check the PR I've done. Should solve the issue.

It seems that this issue is also present in laravel 5.4
Can anyone confirm ?

It probably would affect it now - yes.

Best bet is update to Laravel 5.5

Was this page helpful?
0 / 5 - 0 ratings