com php-src: Forgot to apply important peace of patch: ext/session/session.c ext/session/tests/session_set_save_ handler_variation5.phpt
| From: | Yasuo Ohgaki | Date: | Wed, 28 Jan 2015 05:22:22 +0000 |
| Subject: | com php-src: Forgot to apply important peace of patch: ext/session/session.c ext/session/tests/session_set_save_ handler_variation5.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84432@lists.php.net to get a copy of this message | ||
Commit: 4d747b13567f5e178daebc79ddc99e5a2143fd1e
Author: Yasuo Ohgaki <yohgaki@php.net> Wed, 28 Jan 2015 14:22:22 +0900
Parents: feeaaa4c3fe68bfcc3a2e3c096b246aa69cc048b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4d747b13567f5e178daebc79ddc99e5a2143fd1e
Log:
Forgot to apply important peace of patch
Changed paths:
M ext/session/session.c
M ext/session/tests/session_set_save_handler_variation5.phpt
Diff:
diff --git a/ext/session/session.c b/ext/session/session.c
index 9c995b6..dd3c24c 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -553,38 +553,40 @@ static void php_session_initialize(void) /* {{{ */
}
/* }}} */
-static void php_session_save_current_state(void) /* {{{ */
+static void php_session_save_current_state(int write) /* {{{ */
{
int ret = FAILURE;
- IF_SESSION_VARS() {
- if (PS(mod_data) || PS(mod_user_implemented)) {
- zend_string *val;
-
- val = php_session_encode();
- if (val) {
- if (PS(lazy_write) && PS(session_vars)
- && PS(mod)->s_update_timestamp
- && PS(mod)->s_update_timestamp != php_session_update_timestamp
- && val->len == PS(session_vars)->len
- && !memcmp(val->val, PS(session_vars)->val, val->len)
- ) {
- ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val);
+ if (write) {
+ IF_SESSION_VARS() {
+ if (PS(mod_data) || PS(mod_user_implemented)) {
+ zend_string *val;
+
+ val = php_session_encode();
+ if (val) {
+ if (PS(lazy_write) && PS(session_vars)
+ && PS(mod)->s_update_timestamp
+ && PS(mod)->s_update_timestamp != php_session_update_timestamp
+ && val->len == PS(session_vars)->len
+ && !memcmp(val->val, PS(session_vars)->val, val->len)
+ ) {
+ ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val);
+ } else {
+ ret = PS(mod)->s_write(&PS(mod_data), PS(id), val);
+ }
+ zend_string_release(val);
} else {
- ret = PS(mod)->s_write(&PS(mod_data), PS(id), val);
+ ret = PS(mod)->s_write(&PS(mod_data), PS(id), STR_EMPTY_ALLOC());
}
- zend_string_release(val);
- } else {
- ret = PS(mod)->s_write(&PS(mod_data), PS(id), STR_EMPTY_ALLOC());
}
- }
- if ((ret == FAILURE) && !EG(exception)) {
- php_error_docref(NULL, E_WARNING, "Failed to write session data (%s). Please "
- "verify that the current setting of session.save_path "
- "is correct (%s)",
- PS(mod)->s_name,
- PS(save_path));
+ if ((ret == FAILURE) && !EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Failed to write session data (%s). Please "
+ "verify that the current setting of session.save_path "
+ "is correct (%s)",
+ PS(mod)->s_name,
+ PS(save_path));
+ }
}
}
@@ -1634,11 +1636,11 @@ PHPAPI void php_session_start(void) /* {{{ */
}
/* }}} */
-static void php_session_flush(void) /* {{{ */
+static void php_session_flush(int write) /* {{{ */
{
if (PS(session_status) == php_session_active) {
PS(session_status) = php_session_none;
- php_session_save_current_state();
+ php_session_save_current_state(write);
}
}
/* }}} */
@@ -2234,7 +2236,7 @@ static PHP_FUNCTION(session_start)
}
if (read_and_close) {
- php_session_flush();
+ php_session_flush(0);
}
RETURN_TRUE;
@@ -2274,7 +2276,7 @@ static PHP_FUNCTION(session_unset)
Write session data and end session */
static PHP_FUNCTION(session_write_close)
{
- php_session_flush();
+ php_session_flush(1);
}
/* }}} */
@@ -2334,7 +2336,7 @@ static PHP_FUNCTION(session_register_shutdown)
* If the user does have a later shutdown function which needs the
* session then tough luck.
*/
- php_session_flush();
+ php_session_flush(1);
php_error_docref(NULL, E_WARNING, "Unable to register session flush function");
}
}
@@ -2556,7 +2558,7 @@ static PHP_RSHUTDOWN_FUNCTION(session) /* {{{ */
int i;
zend_try {
- php_session_flush();
+ php_session_flush(1);
} zend_end_try();
php_rshutdown_session_globals();
@@ -2802,7 +2804,7 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress,
i
if (Z_REFCOUNTED(progress->data)) Z_ADDREF(progress->data);
zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s,
&progress->data);
}
- php_session_flush();
+ php_session_flush(1);
} /* }}} */
static void php_session_rfc1867_cleanup(php_session_rfc1867_progress *progress) /* {{{ */
@@ -2812,7 +2814,7 @@ static void php_session_rfc1867_cleanup(php_session_rfc1867_progress
*progress)
IF_SESSION_VARS() {
zend_hash_del(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s);
}
- php_session_flush();
+ php_session_flush(1);
} /* }}} */
static int php_session_rfc1867_callback(unsigned int event, void *event_data, void **extra) /* {{{
*/
diff --git a/ext/session/tests/session_set_save_handler_variation5.phpt
b/ext/session/tests/session_set_save_handler_variation5.phpt
index e1c0de4..4afcf64 100644
--- a/ext/session/tests/session_set_save_handler_variation5.phpt
+++ b/ext/session/tests/session_set_save_handler_variation5.phpt
@@ -80,9 +80,9 @@ ValidateID [%s,PHPT-%d]
Read [%s,PHPT-%d]
GC [0]
1 deleted
+bool(true)
Write [%s,PHPT-%d,]
Close [%s,PHPSESSID]
-bool(true)
NULL
string(15) "PHPT-%d"
*** Cleanup ***