|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-10-25 17:05 UTC] cmb@php.net
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: yohgaki
[2016-10-25 17:05 UTC] cmb@php.net
[2016-10-25 18:28 UTC] yohgaki@php.net
-Type: Bug
+Type: Documentation Problem
[2016-10-25 18:28 UTC] yohgaki@php.net
[2016-10-25 18:59 UTC] yohgaki@php.net
-Status: Verified
+Status: Not a bug
[2016-10-25 18:59 UTC] yohgaki@php.net
[2016-10-25 19:14 UTC] yohgaki@php.net
[2016-10-25 20:03 UTC] ryan dot brothers at gmail dot com
[2016-10-26 00:32 UTC] yohgaki@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 11:00:02 2025 UTC |
Description: ------------ When using a custom session handler in PHP 7 or 7.1, when session_regenerate_id() is called, the read function is called on the new session_id. This does not occur in PHP 5.6. This extra call to read is causing an issue in my custom session handler. From my testing, it appears to ignore the result of the read call anyway as in the below, abc remains 1. Is there a reason for this extra call to read? Thanks for your help. Test script: --------------- <?php class test_session_handler implements SessionHandlerInterface { public function open($save_path, $session_name) { return true; } public function close() { return true; } public function read($id) { if ($GLOBALS['in_session_regenerate_id'] == true) { echo 'read in session_regenerate_id<br>'; return 'abc|i:2;'; } else { echo 'read<br>'; return 'abc|i:1;'; } } public function write($session_id, $session_data) { return true; } public function destroy($session_id) { return true; } public function gc($maxlifetime) { return true; } } ob_start(); $GLOBALS['in_session_regenerate_id'] = false; session_set_save_handler(new test_session_handler()); session_start(); echo 'start session_regenerate_id<br>'; $GLOBALS['in_session_regenerate_id'] = true; session_regenerate_id(true); echo 'end session_regenerate_id<br>'; echo $_SESSION['abc']; Expected result: ---------------- read start session_regenerate_id end session_regenerate_id 1 Actual result: -------------- read start session_regenerate_id read in session_regenerate_id end session_regenerate_id 1