|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-12-29 02:14 UTC] yohgaki@php.net
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: yohgaki
[2015-12-29 02:14 UTC] yohgaki@php.net
[2016-01-15 20:41 UTC] yohgaki@php.net
-Status: Verified
+Status: Closed
[2016-01-15 20:41 UTC] yohgaki@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 06:00:01 2025 UTC |
Description: ------------ When extending \SessionHandler's read method and calling the parent method the session data is still read from the session returned by the PHP function "session_id()" instead of the defined session id. As a workaround it is possible to use `session_id('mycustomsession')` before reading the value and resetting it to the previous value. Note that the test script is not a real-world scenario and just illustrating the behaviour. Test script: --------------- <?php class CustomReadHandler extends \SessionHandler { public function read($session_id) { parent::read('mycustomsession'); } } session_set_save_handler(new CustomReadHandler(), true); session_start(); $_SESSION['foo'] = 'bar'; var_dump($_SESSION); Expected result: ---------------- The session mycustomsession is used. Instead the session returned by "session_id" id is used. Data is thus stored in sess_jtmv4c76rqarqpt475ptkskr15 instead of sess_mycustomsession. Actual result: -------------- Data is read from the session defined by the PHP function "session_id()".