com php-src: Fixed bug #71394 (session_regenerate_id( ) must close opened session on errors): NEW S ext/session/session.c
| From: | Yasuo Ohgaki | Date: | Sun, 17 Jan 2016 08:11:47 +0000 |
| Subject: | com php-src: Fixed bug #71394 (session_regenerate_id( ) must close opened session on errors): NEW S ext/session/session.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90668@lists.php.net to get a copy of this message | ||
Commit: 3b2d98a62509b4b31ac21df0f391d3161ad95203
Author: Yasuo Ohgaki <yohgaki@php.net> Sun, 17 Jan 2016 17:09:08 +0900
Parents: 00eaaca18af592aa578b128eb6681d20e715feb7
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3b2d98a62509b4b31ac21df0f391d3161ad95203
Log:
Fixed bug #71394 (session_regenerate_id() must close opened session on errors)
Bugs:
https://bugs.php.net/71394
Changed paths:
M NEWS
M ext/session/session.c
Diff:
diff --git a/NEWS b/NEWS
index 3326ff4..d18dada 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,8 @@ PHP NEWS
Session save handlers must return 'string' always for successful read.
i.e. Non-existing session read must return empty string. PHP 7.0 is made
not to tolerate buggy return value. (Yasuo)
+ . Fixed bug #71394 (session_regenerate_id() must close opened session on errors).
+ (Yasuo)
- Standard:
. Fixed bug #71287 (Error message contains hexadecimal instead of decimal
diff --git a/ext/session/session.c b/ext/session/session.c
index 0ff8600...8427f85 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -2113,6 +2113,7 @@ static PHP_FUNCTION(session_regenerate_id)
zend_string_release(PS(id));
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
if (!PS(id)) {
+ PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create session ID by collision: %s
(path: %s)", PS(mod)->s_name, PS(save_path));
RETURN_FALSE;
@@ -2120,6 +2121,7 @@ static PHP_FUNCTION(session_regenerate_id)
}
/* Read is required to make new session data at this point.. */
if (PS(mod)->s_read(&PS(mod_data), PS(id), &data, PS(gc_maxlifetime)) == FAILURE) {
+ PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create(read) session ID: %s (path:
%s)", PS(mod)->s_name, PS(save_path));
RETURN_FALSE;