com php-src: The argument must be not changed in session_star t: ext/session/session.c ext/session/tests/session_ba sic1.phpt

From: Date: Thu, 29 Jan 2015 04:26:13 +0000
Subject: com php-src: The argument must be not changed in session_star t: ext/session/session.c ext/session/tests/session_ba sic1.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84436@lists.php.net to get a copy of this message
Commit: 4da7e4de295fa5716c093ff9b0c5c4555a8da52c Author: Xinchen Hui <laruence@php.net> Thu, 29 Jan 2015 12:22:55 +0800 Parents: a1d9ceac7adb411e2b54ad8bd993c28261d5ae85 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4da7e4de295fa5716c093ff9b0c5c4555a8da52c Log: The argument must be not changed in session_start Changed paths: M ext/session/session.c M ext/session/tests/session_basic1.phpt Diff: diff --git a/ext/session/session.c b/ext/session/session.c index 28cda1b..1b2e082 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -2217,13 +2217,13 @@ static PHP_FUNCTION(session_start) case IS_FALSE: case IS_LONG: if (zend_string_equals_literal(str_idx, "read_and_close")) { - convert_to_boolean(value); - read_and_close = (Z_TYPE_P(value) == IS_TRUE) ? 1 : 0; + read_and_close = zval_get_long(value); } else { - convert_to_string(value); - if (php_session_start_set_ini(str_idx, Z_STR_P(value)) == FAILURE) { + zend_string *val = zval_get_string(value); + if (php_session_start_set_ini(str_idx, val) == FAILURE) { php_error_docref(NULL, E_WARNING, "Setting option '%s' failed", str_idx->val); } + zend_string_release(val); } break; default: diff --git a/ext/session/tests/session_basic1.phpt b/ext/session/tests/session_basic1.phpt index 616fdfc..8a8f436 100644 --- a/ext/session/tests/session_basic1.phpt +++ b/ext/session/tests/session_basic1.phpt @@ -30,7 +30,9 @@ var_dump(session_save_path($path)); echo "*** Without lazy_write ***\n"; var_dump(session_id($session_id)); -var_dump(session_start(['lazy_write'=>FALSE])); +$config = ['lazy_write'=>FALSE]; +var_dump(session_start($config)); +var_dump($config); var_dump(session_write_close()); var_dump(session_id()); @@ -53,6 +55,10 @@ string(0) "" *** Without lazy_write *** string(6) "testid" bool(true) +array(1) { + ["lazy_write"]=> + bool(false) +} NULL string(6) "testid" *** With lazy_write *** @@ -64,4 +70,3 @@ string(6) "testid" string(6) "testid" bool(true) bool(true) -

« previous php.cvs (#84436) next »