Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,7 @@ static PHP_FUNCTION(session_regenerate_id)
RETURN_FALSE;
}
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)) {
Expand Down Expand Up @@ -2285,7 +2285,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;
Expand Down
2 changes: 1 addition & 1 deletion ext/session/tests/bug79091.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MySessionHandler implements SessionHandlerInterface, SessionIdInterface, S

public function validateId($key)
{
return false;
return true;
}
}

Expand Down
15 changes: 15 additions & 0 deletions ext/session/tests/bug79413.phpt
Original file line number Diff line number Diff line change
@@ -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)