mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79413: session_create_id() fails for active sessions
This commit is contained in:
commit
12ca4fe65d
3 changed files with 18 additions and 3 deletions
|
@ -2231,7 +2231,7 @@ static PHP_FUNCTION(session_regenerate_id)
|
|||
RETURN_THROWS();
|
||||
}
|
||||
if (PS(use_strict_mode) && PS(mod)->s_validate_sid &&
|
||||
PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) {
|
||||
PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == SUCCESS) {
|
||||
zend_string_release_ex(PS(id), 0);
|
||||
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
|
||||
if (!PS(id)) {
|
||||
|
@ -2293,7 +2293,7 @@ static PHP_FUNCTION(session_create_id)
|
|||
break;
|
||||
} else {
|
||||
/* Detect collision and retry */
|
||||
if (PS(mod)->s_validate_sid(&PS(mod_data), new_id) == FAILURE) {
|
||||
if (PS(mod)->s_validate_sid(&PS(mod_data), new_id) == SUCCESS) {
|
||||
zend_string_release_ex(new_id, 0);
|
||||
new_id = NULL;
|
||||
continue;
|
||||
|
|
|
@ -50,7 +50,7 @@ class MySessionHandler implements SessionHandlerInterface, SessionIdInterface, S
|
|||
|
||||
public function validateId($key)
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
15
ext/session/tests/bug79413.phpt
Normal file
15
ext/session/tests/bug79413.phpt
Normal file
|
@ -0,0 +1,15 @@
|
|||
--TEST--
|
||||
Bug #79413 (session_create_id() fails for active sessions)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('session')) die('skip session extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
session_start();
|
||||
$old = session_id();
|
||||
$new = session_create_id();
|
||||
var_dump($new !== $old);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
Loading…
Add table
Add a link
Reference in a new issue