Skip to content

session_start(): Failed to decode session object. Session has been destroyed (2) #3

@krmu

Description

@krmu

Hello!

The current code doesn't allow you to run a session, but it works if you use the test_mode parameter. I tested it on two machines.

Error:

500 Internal Server Error
session_start(): Failed to decode session object. Session has been destroyed (2)

#0 [internal function]: flight\Engine->handleError()
#1 *confidential*\flight\vendor\flightphp\session\src\Session.php(79): session_start()
#2 *confidential*\flight\vendor\flightphp\session\src\Session.php(53): flight\Session->initializeSession()
#3 *confidential*\flight\vendor\flightphp\core\flight\core\Loader.php(144): flight\Session->__construct()
#4 *confidential*\flight\vendor\flightphp\core\flight\core\Loader.php(96): flight\core\Loader->newInstance()
#5 *confidential*\flight\vendor\flightphp\core\flight\Engine.php(162): flight\core\Loader->load()
#6 *confidential*\flight\vendor\flightphp\core\flight\Flight.php(138): flight\Engine->__call()
#7 *confidential*\flight\index.php(14): Flight::__callStatic()
#8 [internal function]: {closure:C:\Users\**\Desktop\flight\index.php:11}()
#9 *confidential*\flight\vendor\flightphp\core\flight\core\Dispatcher.php(356): call_user_func_array()
#10 *confidential*\flight\vendor\flightphp\core\flight\core\Dispatcher.php(289): flight\core\Dispatcher->invokeCallable()
#11 *confidential*\flight\vendor\flightphp\core\flight\Engine.php(604): flight\core\Dispatcher->execute()
#12 [internal function]: flight\Engine->_start()
#13 *confidential*\flight\vendor\flightphp\core\flight\core\Dispatcher.php(378): call_user_func_array()
#14 *confidential*\flight\vendor\flightphp\core\flight\core\Dispatcher.php(289): flight\core\Dispatcher->invokeCallable()
#15 *confidential*\flight\vendor\flightphp\core\flight\core\Dispatcher.php(133): flight\core\Dispatcher->execute()
#16 *confidential*\flight\vendor\flightphp\core\flight\core\Dispatcher.php(97): flight\core\Dispatcher->runEvent()
#17 *confidential*\flight\vendor\flightphp\core\flight\Engine.php(153): flight\core\Dispatcher->run()
#18 *confidential*\flight\vendor\flightphp\core\flight\Flight.php(138): flight\Engine->__call()
#19 *confidential*\flight\index.php(27)

My test Flight index.php file:

require 'vendor/autoload.php';

use flight\Session;

Flight::register('session', Session::class, [
  ['test_mode' => false]
]);

Flight::route('/', function () {
  echo "<p>Session Test</p>";
  echo "<p>Startng session</p>";
  $session = Flight::session();
  echo "<p>Session ID: ".$session->id()."</p>";
  echo "<p>Setting variable</p>";
  $session->set('variable', 123);
  echo "<p>Getting variable</p>";
  echo $session->get('variable');
  echo "<p>Clearing session</p>";
  $session->clear();
  echo "<p>Checking if exists variable</p>";
  echo $session->get('variable',"NOT EXISTING");
  echo "<p>Done</p>";
});

Flight::start();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions