com php-src: Fixed session module is sending multiple set-cookie headers when session.use_strict_mode=1: NEWS ext/sessio n/mod_files.c
ext/session/mod_mm.c ext/session/sess ion.c

From: Date: Wed, 15 Jan 2014 02:06:06 +0000
Subject: com php-src: Fixed session module is sending multiple set-cookie headers when session.use_strict_mode=1: NEWS ext/sessio n/mod_files.c
ext/session/mod_mm.c ext/session/sess ion.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75625@lists.php.net to get a copy of this message
Commit: f52c251f60c8c6d1bd01f3d87d69ed45f7a1bfa4 Author: Yasuo Ohgaki <yohgaki@php.net> Wed, 15 Jan 2014 11:03:07 +0900 Parents: 9c32d30020a96050d1767fa2738a0b7fd537f2ce Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f52c251f60c8c6d1bd01f3d87d69ed45f7a1bfa4 Log: Fixed session module is sending multiple set-cookie headers when session.use_strict_mode=1 Changed paths: M NEWS M ext/session/mod_files.c M ext/session/mod_mm.c M ext/session/session.c Diff: diff --git a/NEWS b/NEWS index ae9bd72..5564c07 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,10 @@ PHP NEWS . Fixed bug #66298 (ext/opcache/Optimizer/zend_optimizer..c has dos-style ^M as lineend). (Laruence) +- Session + . Fixed session module is sending multiple set-cookie headers when + session.use_strict_mode=1 (Yasuo) + - Standard . Fixed bug #66395 (basename function doesn't remove drive letter). (Anatol) diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index c365760..4d5a18b 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -342,6 +342,7 @@ PS_READ_FUNC(files) PS(send_cookie) = 1; } php_session_reset_id(TSRMLS_C); + PS(session_status) = php_session_active; } ps_files_open(data, PS(id) TSRMLS_CC); diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c index 41df247..319f1d3 100644 --- a/ext/session/mod_mm.c +++ b/ext/session/mod_mm.c @@ -371,6 +371,7 @@ PS_READ_FUNC(mm) PS(send_cookie) = 1; } php_session_reset_id(TSRMLS_C); + PS(session_status) = php_session_active; } sd = ps_sd_lookup(data, PS(id), 0); diff --git a/ext/session/session.c b/ext/session/session.c index c579f1b..c1bdf83 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -492,18 +492,26 @@ static void php_session_initialize(TSRMLS_D) /* {{{ */ } } - php_session_reset_id(TSRMLS_C); - PS(session_status) = php_session_active; + /* Set session ID for compatibility for older/3rd party save handlers */ + if (!PS(use_strict_mode)) { + php_session_reset_id(TSRMLS_C); + PS(session_status) = php_session_active; + } /* Read data */ php_session_track_init(TSRMLS_C); if (PS(mod)->s_read(&PS(mod_data), PS(id), &val, &vallen TSRMLS_CC) == FAILURE) { /* Some broken save handler implementation returns FAILURE for non-existent session ID */ - /* It's better to rase error for this, but disabled error for better compatibility */ + /* It's better to raise error for this, but disabled error for better compatibility */ /* php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path)); */ } + /* Set session ID if session read didn't activated session */ + if (PS(use_strict_mode) && PS(session_status) != php_session_active) { + php_session_reset_id(TSRMLS_C); + PS(session_status) = php_session_active; + } if (val) { php_session_decode(val, vallen TSRMLS_CC); efree(val);

« previous php.cvs (#75625) next »