Bug #70133 [NEW]: Extended SessionHandler::read is ignoring $session_id when calling parent

From: Date: Fri, 24 Jul 2015 19:20:29 +0000
Subject: Bug #70133 [NEW]: Extended SessionHandler::read is ignoring $session_id when calling parent
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194689@lists.php.net to get a copy of this message
From: lukas at owncloud dot com Operating system: Mac OS X PHP version: 5.6.11 Package: Session related Bug Type: Bug Bug description:Extended SessionHandler::read is ignoring $session_id when calling parent 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()". -- Edit bug report at https://bugs.php.net/bug.php?id=70133&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70133&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70133&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70133&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70133&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70133&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70133&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70133&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70133&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70133&r=support Expected behavior: https://bugs.php.net/fix.php?id=70133&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70133&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70133&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70133&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70133&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70133&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70133&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70133&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70133&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70133&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70133&r=mysqlcfg

« previous php.bugs (#194689) next »