diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-03-31 08:39:34 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-03-31 08:39:54 +0200 |
commit | d533fa15e609d894516cb0091b7cdb57667bde1f (patch) | |
tree | 3b05eddece3a470b682d92826e2c53964306ca64 | |
parent | b9b49cfb7b88e0d95d91ea82b75b2b19ca88331a (diff) | |
parent | b510250b8ebe9d90b1db150d7a1edc75893f2e48 (diff) | |
download | php-git-d533fa15e609d894516cb0091b7cdb57667bde1f.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fix #79413: session_create_id() fails for active sessions
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/session/session.c | 4 | ||||
-rw-r--r-- | ext/session/tests/bug79091.phpt | 2 | ||||
-rw-r--r-- | ext/session/tests/bug79413.phpt | 15 |
4 files changed, 21 insertions, 3 deletions
@@ -26,6 +26,9 @@ PHP NEWS . Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script). (Dmitry) +- Session: + . Fixed bug #79413 (session_create_id() fails for active sessions). (cmb) + - Shmop: . Fixed bug #79427 (Integer Overflow in shmop_open()). (cmb) diff --git a/ext/session/session.c b/ext/session/session.c index 092dea81ce..1efe220c77 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -2232,7 +2232,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)) { @@ -2294,7 +2294,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; diff --git a/ext/session/tests/bug79091.phpt b/ext/session/tests/bug79091.phpt index 1d14427159..4d60e69872 100644 --- a/ext/session/tests/bug79091.phpt +++ b/ext/session/tests/bug79091.phpt @@ -50,7 +50,7 @@ class MySessionHandler implements SessionHandlerInterface, SessionIdInterface, S public function validateId($key) { - return false; + return true; } } diff --git a/ext/session/tests/bug79413.phpt b/ext/session/tests/bug79413.phpt new file mode 100644 index 0000000000..756b29f6ea --- /dev/null +++ b/ext/session/tests/bug79413.phpt @@ -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) |