[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-bugs
Subject: [DOC-BUGS] Doc #73343 [Ver->Nab]: extra call to read in session_regenerate_id in custom session hand
From: yohgaki () php ! net
Date: 2016-10-25 18:59:22
Message-ID: 201610251859.u9PIxMGE019498 () sgrv20 ! php ! net
[Download RAW message or body]
Edit report at https://bugs.php.net/bug.php?id=73343&edit=1
ID: 73343
Updated by: yohgaki@php.net
Reported by: ryan dot brothers at gmail dot com
Summary: extra call to read in session_regenerate_id in
custom session handler
-Status: Verified
+Status: Not a bug
Type: Documentation Problem
Package: Session related
Operating System: Linux
PHP Version: 7.1.0RC3
Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
Oops. This change was made in PHP 7.0 and documented already.
Previous Comments:
------------------------------------------------------------------------
[2016-10-25 18:28:51] yohgaki@php.net
As a result of a bug fix, session_regenerate_id() save old session and start new \
session from 7.1
I've added UPGRADING.
------------------------------------------------------------------------
[2016-10-25 17:05:24] cmb@php.net
This behavioral change has been introduced by fixing bug #61470.
Is the additional read desired or necessary, Yasuo? If so, this
should probably be documented.
------------------------------------------------------------------------
[2016-10-18 23:51:52] ryan dot brothers at gmail dot com
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73343&edit=1
--
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic