summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-09-01 20:57:33 +0400
committerDmitry Stogov <dmitry@zend.com>2014-09-01 20:57:33 +0400
commit88d7ca44f645c6e1bbdb17affd7a34113911093d (patch)
tree15c356bf3749c703ca52e89081ec8219d237b615 /ext
parentb9f3247267299cd38da851057c1bb90090db3e20 (diff)
downloadphp-git-88d7ca44f645c6e1bbdb17affd7a34113911093d.tar.gz
Refactored INI subsystem to use zend_string* instead of char*
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c10
-rw-r--r--ext/exif/exif.c14
-rw-r--r--ext/filter/filter.c4
-rw-r--r--ext/iconv/iconv.c23
-rw-r--r--ext/intl/locale/locale_methods.c15
-rw-r--r--ext/mbstring/mbstring.c40
-rw-r--r--ext/mysql/php_mysql.c2
-rw-r--r--ext/mysqlnd/php_mysqlnd.c2
-rw-r--r--ext/odbc/php_odbc.c20
-rw-r--r--ext/opcache/ZendAccelerator.c6
-rw-r--r--ext/opcache/zend_accelerator_module.c31
-rw-r--r--ext/phar/phar.c16
-rw-r--r--ext/readline/readline_cli.c4
-rw-r--r--ext/reflection/php_reflection.c13
-rw-r--r--ext/session/session.c105
-rw-r--r--ext/soap/soap.c10
-rw-r--r--ext/standard/assert.c20
-rw-r--r--ext/standard/basic_functions.c38
-rw-r--r--ext/standard/browscap.c2
-rw-r--r--ext/standard/url_scanner_ex.c2
-rw-r--r--ext/standard/url_scanner_ex.re2
-rw-r--r--ext/tidy/tidy.c10
-rw-r--r--ext/zlib/zlib.c33
23 files changed, 213 insertions, 209 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 2a17ab8d54..cf3f6214a5 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -932,7 +932,7 @@ timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib
/* {{{ static PHP_INI_MH(OnUpdate_date_timezone) */
static PHP_INI_MH(OnUpdate_date_timezone)
{
- if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
+ if (OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
return FAILURE;
}
@@ -959,11 +959,11 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
/* Check config setting for default timezone */
if (!DATEG(default_timezone)) {
/* Special case: ext/date wasn't initialized yet */
- zval ztz;
+ zval *ztz;
- if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz)
- && Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
- return Z_STRVAL(ztz);
+ if (NULL != (ztz = cfg_get_entry("date.timezone", sizeof("date.timezone")))
+ && Z_TYPE_P(ztz) == IS_STRING && Z_STRLEN_P(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL_P(ztz), tzdb)) {
+ return Z_STRVAL_P(ztz);
}
} else if (*DATEG(default_timezone)) {
if (DATEG(timezone_valid) == 1) {
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 9b6d86c415..fe60a3d8d4 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -166,17 +166,17 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
ZEND_INI_MH(OnUpdateEncode)
{
- if (new_value && new_value_length) {
+ if (new_value && new_value->len) {
const zend_encoding **return_list;
size_t return_size;
- if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length,
+ if (FAILURE == zend_multibyte_parse_encoding_list(new_value->val, new_value->len,
&return_list, &return_size, 0 TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value->val);
return FAILURE;
}
efree(return_list);
}
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
ZEND_INI_MH(OnUpdateDecode)
@@ -184,14 +184,14 @@ ZEND_INI_MH(OnUpdateDecode)
if (new_value) {
const zend_encoding **return_list;
size_t return_size;
- if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length,
+ if (FAILURE == zend_multibyte_parse_encoding_list(new_value->val, new_value->len,
&return_list, &return_size, 0 TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value->val);
return FAILURE;
}
efree(return_list);
}
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
PHP_INI_BEGIN()
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index e53e84f855..873a6f83b3 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -160,7 +160,7 @@ static PHP_INI_MH(UpdateDefaultFilter) /* {{{ */
int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
for (i = 0; i < size; ++i) {
- if ((strcasecmp(new_value, filter_list[i].name) == 0)) {
+ if ((strcasecmp(new_value->val, filter_list[i].name) == 0)) {
IF_G(default_filter) = filter_list[i].id;
return SUCCESS;
}
@@ -178,7 +178,7 @@ static PHP_INI_MH(OnUpdateFlags)
if (!new_value) {
IF_G(default_filter_flags) = FILTER_FLAG_NO_ENCODE_QUOTES;
} else {
- IF_G(default_filter_flags) = atoi(new_value);
+ IF_G(default_filter_flags) = atoi(new_value->val);
}
return SUCCESS;
}
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index ee4bdb8166..66b696950e 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -223,39 +223,39 @@ static char _generic_superset_name[] = ICONV_UCS4_ENCODING;
static PHP_INI_MH(OnUpdateInputEncoding)
{
- if (new_value_length >= ICONV_CSNMAXLEN) {
+ if (new_value->len >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.input_encoding is deprecated");
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
static PHP_INI_MH(OnUpdateOutputEncoding)
{
- if(new_value_length >= ICONV_CSNMAXLEN) {
+ if(new_value->len >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.output_encoding is deprecated");
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
static PHP_INI_MH(OnUpdateInternalEncoding)
{
- if(new_value_length >= ICONV_CSNMAXLEN) {
+ if(new_value->len >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
php_error_docref("ref.iconv" TSRMLS_CC, E_DEPRECATED, "Use of iconv.internal_encoding is deprecated");
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
@@ -2456,14 +2456,15 @@ PHP_NAMED_FUNCTION(php_if_iconv)
Sets internal encoding and output encoding for ob_iconv_handler() */
PHP_FUNCTION(iconv_set_encoding)
{
- char *type, *charset;
- size_t type_len, charset_len = 0, retval;
+ char *type;
+ zend_string *charset;
+ size_t type_len, retval;
zend_string *name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &type, &type_len, &charset, &charset_len) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sS", &type, &type_len, &charset) == FAILURE)
return;
- if (charset_len >= ICONV_CSNMAXLEN) {
+ if (charset->len >= ICONV_CSNMAXLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
@@ -2478,7 +2479,7 @@ PHP_FUNCTION(iconv_set_encoding)
RETURN_FALSE;
}
- retval = zend_alter_ini_entry(name, charset, charset_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ retval = zend_alter_ini_entry(name, charset, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(name);
if (retval == SUCCESS) {
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 843f669342..81978850ee 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -223,12 +223,11 @@ PHP_NAMED_FUNCTION(zif_locale_get_default)
Set default locale */
PHP_NAMED_FUNCTION(zif_locale_set_default)
{
- char* locale_name = NULL;
- size_t len = 0;
+ zend_string* locale_name;
zend_string *ini_name;
+ char *default_locale = NULL;
- if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &locale_name ,&len ) == FAILURE)
+ if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "S", &locale_name) == FAILURE)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"locale_set_default: unable to parse input params", 0 TSRMLS_CC );
@@ -236,13 +235,13 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
RETURN_FALSE;
}
- if(len == 0) {
- locale_name = (char *)uloc_getDefault() ;
- len = strlen(locale_name);
+ if (locale_name->len == 0) {
+ default_locale = (char *)uloc_getDefault();
+ locale_name = zend_string_init(default_locale, strlen(default_locale), 0);
}
ini_name = zend_string_init(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0);
- zend_alter_ini_entry(ini_name, locale_name, len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, locale_name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
RETURN_TRUE;
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 8718e9f8f2..212c8d013f 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -1209,7 +1209,7 @@ static PHP_INI_MH(OnUpdate_mbstring_language)
{
enum mbfl_no_language no_language;
- no_language = mbfl_name2no_language(new_value);
+ no_language = mbfl_name2no_language(new_value->val);
if (no_language == mbfl_no_language_invalid) {
MBSTRG(language) = mbfl_no_language_neutral;
return FAILURE;
@@ -1235,7 +1235,7 @@ static PHP_INI_MH(OnUpdate_mbstring_detect_order)
return SUCCESS;
}
- if (FAILURE == php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) {
+ if (FAILURE == php_mb_parse_encoding_list(new_value->val, new_value->len, &list, &size, 1 TSRMLS_CC)) {
return FAILURE;
}
@@ -1268,7 +1268,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
return SUCCESS;
}
- if (FAILURE == php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) {
+ if (FAILURE == php_mb_parse_encoding_list(new_value->val, new_value->len, &list, &size, 1 TSRMLS_CC)) {
return FAILURE;
}
@@ -1291,7 +1291,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
{
const mbfl_encoding *encoding;
- if (new_value == NULL || new_value_length == 0) {
+ if (new_value == NULL || new_value->len == 0) {
encoding = mbfl_name2encoding(get_output_encoding(TSRMLS_C));
if (!encoding) {
MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
@@ -1299,7 +1299,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
return SUCCESS;
}
} else {
- encoding = mbfl_name2encoding(new_value);
+ encoding = mbfl_name2encoding(new_value->val);
if (!encoding) {
MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass;
@@ -1350,13 +1350,13 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
php_error_docref("ref.mbstring" TSRMLS_CC, E_DEPRECATED, "Use of mbstring.internal_encoding is deprecated");
}
- if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
+ if (OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_STARTUP | PHP_INI_STAGE_SHUTDOWN | PHP_INI_STAGE_RUNTIME)) {
- if (new_value_length) {
- return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC);
+ if (new_value && new_value->len) {
+ return _php_mb_ini_mbstring_internal_encoding_set(new_value->val, new_value->len TSRMLS_CC);
} else {
return _php_mb_ini_mbstring_internal_encoding_set(get_internal_encoding(TSRMLS_C), strlen(get_internal_encoding(TSRMLS_C))+1 TSRMLS_CC);
}
@@ -1379,20 +1379,20 @@ static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
char *endptr = NULL;
if (new_value != NULL) {
- if (strcasecmp("none", new_value) == 0) {
+ if (strcasecmp("none", new_value->val) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- } else if (strcasecmp("long", new_value) == 0) {
+ } else if (strcasecmp("long", new_value->val) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
- } else if (strcasecmp("entity", new_value) == 0) {
+ } else if (strcasecmp("entity", new_value->val) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- if (new_value_length >0) {
- c = strtol(new_value, &endptr, 0);
+ if (new_value->len >0) {
+ c = strtol(new_value->val, &endptr, 0);
if (*endptr == '\0') {
MBSTRG(filter_illegal_substchar) = c;
MBSTRG(current_filter_illegal_substchar) = c;
@@ -1417,7 +1417,7 @@ static PHP_INI_MH(OnUpdate_mbstring_encoding_translation)
return FAILURE;
}
- OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
if (MBSTRG(encoding_translation)) {
sapi_unregister_post_entry(php_post_entries TSRMLS_CC);
@@ -1439,9 +1439,8 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes)
if (!new_value) {
new_value = entry->orig_value;
- new_value_length = entry->orig_value_length;
}
- php_trim(new_value, new_value_length, NULL, 0, &tmp, 3 TSRMLS_CC);
+ php_trim(new_value->val, new_value->len, NULL, 0, &tmp, 3 TSRMLS_CC);
if (Z_STRLEN(tmp) > 0) {
if (!(re = _php_mb_compile_regex(Z_STRVAL(tmp) TSRMLS_CC))) {
@@ -1732,18 +1731,17 @@ PHP_MINFO_FUNCTION(mbstring)
Sets the current language or Returns the current language as a string */
PHP_FUNCTION(mb_language)
{
- char *name = NULL;
- size_t name_len = 0;
+ zend_string *name = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
if (name == NULL) {
RETVAL_STRING((char *)mbfl_no_language2name(MBSTRG(language)));
} else {
zend_string *ini_name = zend_string_init("mbstring.language", sizeof("mbstring.language") - 1, 0);
- if (FAILURE == zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name);
+ if (FAILURE == zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name->val);
RETVAL_FALSE;
} else {
RETVAL_TRUE;
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 424f923d78..e3535bc769 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -485,7 +485,7 @@ static void _close_mysql_plink(zend_resource *rsrc TSRMLS_DC)
static PHP_INI_MH(OnMySQLPort)
{
if (new_value != NULL) { /* default port */
- MySG(default_port) = atoi(new_value);
+ MySG(default_port) = atoi(new_value->val);
} else {
MySG(default_port) = -1;
}
diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c
index 15d572793b..33c57c23d5 100644
--- a/ext/mysqlnd/php_mysqlnd.c
+++ b/ext/mysqlnd/php_mysqlnd.c
@@ -208,7 +208,7 @@ static PHP_INI_MH(OnUpdateNetCmdBufferSize)
{
zend_long long_value;
- ZEND_ATOL(long_value, new_value);
+ ZEND_ATOL(long_value, new_value->val);
if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) {
return FAILURE;
}
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 9b1149e13d..02af2d94ca 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -524,9 +524,9 @@ static PHP_INI_DISP(display_link_nums)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -549,9 +549,9 @@ static PHP_INI_DISP(display_defPW)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -580,9 +580,9 @@ static PHP_INI_DISP(display_binmode)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -611,9 +611,9 @@ static PHP_INI_DISP(display_lrl)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
@@ -637,9 +637,9 @@ static PHP_INI_DISP(display_cursortype)
TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
+ value = ini_entry->orig_value->val;
} else if (ini_entry->value) {
- value = ini_entry->value;
+ value = ini_entry->value->val;
} else {
value = NULL;
}
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 053a17c993..d72383ace8 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -192,13 +192,13 @@ void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason T
*/
static ZEND_INI_MH(accel_include_path_on_modify)
{
- int ret = orig_include_path_on_modify(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ int ret = orig_include_path_on_modify(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
ZCG(include_path_key) = NULL;
if (ret == SUCCESS) {
- ZCG(include_path) = new_value;
+ ZCG(include_path) = new_value->val;
if (ZCG(include_path) && *ZCG(include_path)) {
- ZCG(include_path_len) = new_value_length;
+ ZCG(include_path_len) = new_value->len;
if (ZCG(enabled) && accel_startup_ok &&
(ZCG(counted) || ZCSG(accelerator_enabled))) {
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index a53ed122e6..001c3ee9ed 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -109,10 +109,10 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
#endif
/* keep the compiler happy */
- (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
+ (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
p = (zend_long *) (base + (size_t)mh_arg1);
- memsize = atoi(new_value);
+ memsize = atoi(new_value->val);
/* sanity check we must use at least 8 MB */
if (memsize < 8) {
const char *new_new_value = "8";
@@ -128,8 +128,7 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)
return FAILURE;
}
- ini_entry->value = strdup(new_new_value);
- ini_entry->value_length = strlen(new_new_value);
+ ini_entry->value = zend_string_init(new_new_value, 1, 1);
}
*p = memsize * (1024 * 1024);
return SUCCESS;
@@ -146,10 +145,10 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
#endif
/* keep the compiler happy */
- (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
+ (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
p = (zend_long *) (base + (size_t)mh_arg1);
- size = atoi(new_value);
+ size = atoi(new_value->val);
/* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */
if (size < MIN_ACCEL_FILES || size > MAX_ACCEL_FILES) {
@@ -173,8 +172,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles)
sizeof("opcache.max_accelerated_files")-1)) == NULL) {
return FAILURE;
}
- ini_entry->value = strdup(new_new_value);
- ini_entry->value_length = strlen(new_new_value);
+ ini_entry->value = zend_string_init(new_new_value, strlen(new_new_value), 1);
}
*p = size;
return SUCCESS;
@@ -191,10 +189,10 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
#endif
/* keep the compiler happy */
- (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage;
+ (void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
p = (double *) (base + (size_t)mh_arg1);
- percentage = atoi(new_value);
+ percentage = atoi(new_value->val);
if (percentage <= 0 || percentage > 50) {
const char *new_new_value = "5";
@@ -208,8 +206,7 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
sizeof("opcache.max_wasted_percentage")-1)) == NULL) {
return FAILURE;
}
- ini_entry->value = strdup(new_new_value);
- ini_entry->value_length = strlen(new_new_value);
+ ini_entry->value = zend_string_init(new_new_value, strlen(new_new_value), 1);
}
*p = (double)percentage / 100.0;
return SUCCESS;
@@ -220,7 +217,7 @@ static ZEND_INI_MH(OnEnable)
if (stage == ZEND_INI_STAGE_STARTUP ||
stage == ZEND_INI_STAGE_SHUTDOWN ||
stage == ZEND_INI_STAGE_DEACTIVATE) {
- return OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
} else {
/* It may be only temporary disabled */
zend_bool *p;
@@ -231,10 +228,10 @@ static ZEND_INI_MH(OnEnable)
#endif
p = (zend_bool *) (base+(size_t) mh_arg1);
- if ((new_value_length == 2 && strcasecmp("on", new_value) == 0) ||
- (new_value_length == 3 && strcasecmp("yes", new_value) == 0) ||
- (new_value_length == 4 && strcasecmp("true", new_value) == 0) ||
- atoi(new_value) != 0) {
+ if ((new_value->len == 2 && strcasecmp("on", new_value->val) == 0) ||
+ (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) ||
+ (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) ||
+ atoi(new_value->val) != 0) {
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)");
return FAILURE;
} else {
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 2fd46b9621..4c02e1aecf 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -50,28 +50,28 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
{
zend_bool old, ini;
- if (entry->name_length == sizeof("phar.readonly")-1) {
+ if (entry->name->len == sizeof("phar.readonly")-1) {
old = PHAR_G(readonly_orig);
} else {
old = PHAR_G(require_hash_orig);
}
- if (new_value_length == 2 && !strcasecmp("on", new_value)) {
+ if (new_value->len == 2 && !strcasecmp("on", new_value->val)) {
ini = (zend_bool) 1;
}
- else if (new_value_length == 3 && !strcasecmp("yes", new_value)) {
+ else if (new_value->len == 3 && !strcasecmp("yes", new_value->val)) {
ini = (zend_bool) 1;
}
- else if (new_value_length == 4 && !strcasecmp("true", new_value)) {
+ else if (new_value->len == 4 && !strcasecmp("true", new_value->val)) {
ini = (zend_bool) 1;
}
else {
- ini = (zend_bool) atoi(new_value);
+ ini = (zend_bool) atoi(new_value->val);
}
/* do not allow unsetting in runtime */
if (stage == ZEND_INI_STAGE_STARTUP) {
- if (entry->name_length == sizeof("phar.readonly")-1) {
+ if (entry->name->len == sizeof("phar.readonly")-1) {
PHAR_G(readonly_orig) = ini;
} else {
PHAR_G(require_hash_orig) = ini;
@@ -80,7 +80,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
return FAILURE;
}
- if (entry->name_length == sizeof("phar.readonly")-1) {
+ if (entry->name->len == sizeof("phar.readonly")-1) {
PHAR_G(readonly) = ini;
if (PHAR_GLOBALS->request_init && PHAR_GLOBALS->phar_fname_map.arHash) {
zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_fname_map), phar_set_writeable_bit, (void *)&ini TSRMLS_CC);
@@ -183,7 +183,7 @@ finish_error:
ZEND_INI_MH(phar_ini_cache_list) /* {{{ */
{
- PHAR_G(cache_list) = new_value;
+ PHAR_G(cache_list) = new_value->val;
if (stage == ZEND_INI_STAGE_STARTUP) {
phar_split_cache_list(TSRMLS_C);
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index b23703ea08..a6aeae6779 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -409,7 +409,7 @@ static int cli_is_valid_code(char *code, int len, zend_string **prompt TSRMLS_DC
static char *cli_completion_generator_ht(const char *text, int textlen, int *state, HashTable *ht, void **pData TSRMLS_DC) /* {{{ */
{
zend_string *name;
- ulong number;
+ zend_ulong number;
if (!(*state % 2)) {
zend_hash_internal_pointer_reset(ht);
@@ -633,7 +633,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
param++;
cmd = zend_string_init(&line[1], param - &line[1] - 1, 0);
- zend_alter_ini_entry_ex(cmd, param, strlen(param), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_alter_ini_entry_chars_ex(cmd, param, strlen(param), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
zend_string_release(cmd);
add_history(line);
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 8c4c487da3..a2c88044fd 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -958,7 +958,7 @@ static int _extension_ini_string(zval *el TSRMLS_DC, int num_args, va_list args,
char *comma = "";
if (number == ini_entry->module_number) {
- string_printf(str, " %sEntry [ %s <", indent, ini_entry->name);
+ string_printf(str, " %sEntry [ %s <", indent, ini_entry->name->val);
if (ini_entry->modifiable == ZEND_INI_ALL) {
string_printf(str, "ALL");
} else {
@@ -976,9 +976,9 @@ static int _extension_ini_string(zval *el TSRMLS_DC, int num_args, va_list args,
}
string_printf(str, "> ]\n");
- string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value : "");
+ string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value->val : "");
if (ini_entry->modified) {
- string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value : "");
+ string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value->val : "");
}
string_printf(str, " %s}\n", indent);
}
@@ -5278,9 +5278,12 @@ static int _addinientry(zval *el TSRMLS_DC, int num_args, va_list args, zend_has
if (number == ini_entry->module_number) {
if (ini_entry->value) {
- add_assoc_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length);
+ zval zv;
+
+ ZVAL_STR(&zv, ini_entry->value);
+ zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &zv);
} else {
- add_assoc_null(retval, ini_entry->name);
+ zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &EG(uninitialized_zval));
}
}
return ZEND_HASH_APPLY_KEEP;
diff --git a/ext/session/session.c b/ext/session/session.c
index 9b31bddf3a..de8cf23310 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -581,7 +581,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
ps_module *tmp;
SESSION_CHECK_ACTIVE_STATE;
- tmp = _php_find_ps_module(new_value TSRMLS_CC);
+ tmp = _php_find_ps_module(new_value->val TSRMLS_CC);
if (PG(modules_activated) && !tmp) {
int err_type;
@@ -594,7 +594,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find save handler '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find save handler '%s'", new_value->val);
}
return FAILURE;
}
@@ -611,7 +611,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
const ps_serializer *tmp;
SESSION_CHECK_ACTIVE_STATE;
- tmp = _php_find_ps_serializer(new_value TSRMLS_CC);
+ tmp = _php_find_ps_serializer(new_value->val TSRMLS_CC);
if (PG(modules_activated) && !tmp) {
int err_type;
@@ -624,7 +624,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find serialization handler '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, err_type, "Cannot find serialization handler '%s'", new_value->val);
}
return FAILURE;
}
@@ -638,10 +638,10 @@ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
{
SESSION_CHECK_ACTIVE_STATE;
- if (!strncasecmp(new_value, "on", sizeof("on"))) {
+ if (!strncasecmp(new_value->val, "on", sizeof("on"))) {
PS(use_trans_sid) = (zend_bool) 1;
} else {
- PS(use_trans_sid) = (zend_bool) atoi(new_value);
+ PS(use_trans_sid) = (zend_bool) atoi(new_value->val);
}
return SUCCESS;
@@ -654,19 +654,19 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
char *p;
- if (memchr(new_value, '\0', new_value_length) != NULL) {
+ if (memchr(new_value->val, '\0', new_value->len) != NULL) {
return FAILURE;
}
/* we do not use zend_memrchr() since path can contain ; itself */
- if ((p = strchr(new_value, ';'))) {
+ if ((p = strchr(new_value->val, ';'))) {
char *p2;
p++;
if ((p2 = strchr(p, ';'))) {
p = p2 + 1;
}
} else {
- p = new_value;
+ p = new_value->val;
}
if (PG(open_basedir) && *p && php_check_open_basedir(p TSRMLS_CC)) {
@@ -674,7 +674,7 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
}
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
/* }}} */
@@ -682,7 +682,7 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
static PHP_INI_MH(OnUpdateName) /* {{{ */
{
/* Numeric session.name won't work at all */
- if ((!new_value_length || is_numeric_string(new_value, new_value_length, NULL, NULL, 0))) {
+ if ((!new_value->len || is_numeric_string(new_value->val, new_value->len, NULL, NULL, 0))) {
int err_type;
if (stage == ZEND_INI_STAGE_RUNTIME || stage == ZEND_INI_STAGE_ACTIVATE || stage == ZEND_INI_STAGE_STARTUP) {
@@ -693,12 +693,12 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL TSRMLS_CC, err_type, "session.name cannot be a numeric or empty '%s'", new_value);
+ php_error_docref(NULL TSRMLS_CC, err_type, "session.name cannot be a numeric or empty '%s'", new_value->val);
}
return FAILURE;
}
- OnUpdateStringUnempty(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateStringUnempty(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
/* }}} */
@@ -712,7 +712,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
PS(hash_ops) = NULL;
#endif
- val = ZEND_STRTOL(new_value, &endptr, 10);
+ val = ZEND_STRTOL(new_value->val, &endptr, 10);
if (endptr && (*endptr == '\0')) {
/* Numeric value */
PS(hash_func) = val ? 1 : 0;
@@ -720,15 +720,15 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
return SUCCESS;
}
- if (new_value_length == (sizeof("md5") - 1) &&
- strncasecmp(new_value, "md5", sizeof("md5") - 1) == 0) {
+ if (new_value->len == (sizeof("md5") - 1) &&
+ strncasecmp(new_value->val, "md5", sizeof("md5") - 1) == 0) {
PS(hash_func) = PS_HASH_FUNC_MD5;
return SUCCESS;
}
- if (new_value_length == (sizeof("sha1") - 1) &&
- strncasecmp(new_value, "sha1", sizeof("sha1") - 1) == 0) {
+ if (new_value->len == (sizeof("sha1") - 1) &&
+ strncasecmp(new_value->val, "sha1", sizeof("sha1") - 1) == 0) {
PS(hash_func) = PS_HASH_FUNC_SHA1;
return SUCCESS;
@@ -736,7 +736,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) /* {{{ */
{
- php_hash_ops *ops = (php_hash_ops*)php_hash_fetch_ops(new_value, new_value_length);
+ php_hash_ops *ops = (php_hash_ops*)php_hash_fetch_ops(new_value->val, new_value->len);
if (ops) {
PS(hash_func) = PS_HASH_FUNC_OTHER;
@@ -747,7 +747,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
}
#endif /* HAVE_HASH_EXT }}} */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value->val);
return FAILURE;
}
/* }}} */
@@ -755,12 +755,12 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
{
int tmp;
- tmp = zend_atoi(new_value, new_value_length);
+ tmp = zend_atoi(new_value->val, new_value->len);
if(tmp < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.upload_progress.freq must be greater than or equal to zero");
return FAILURE;
}
- if(new_value_length > 0 && new_value[new_value_length-1] == '%') {
+ if(new_value->len > 0 && new_value->val[new_value->len-1] == '%') {
if(tmp > 100) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.upload_progress.freq cannot be over 100%%");
return FAILURE;
@@ -1643,42 +1643,41 @@ PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t
static PHP_FUNCTION(session_set_cookie_params)
{
zval *lifetime;
- char *path = NULL, *domain = NULL;
- size_t path_len, domain_len;
+ zend_string *path = NULL, *domain = NULL;
int argc = ZEND_NUM_ARGS();
zend_bool secure = 0, httponly = 0;
zend_string *ini_name;
if (!PS(use_cookies) ||
- zend_parse_parameters(argc TSRMLS_CC, "z|ssbb", &lifetime, &path, &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) {
+ zend_parse_parameters(argc TSRMLS_CC, "z|SSbb", &lifetime, &path, &domain, &secure, &httponly) == FAILURE) {
return;
}
convert_to_string_ex(lifetime);
ini_name = zend_string_init("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0);
- zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRLEN_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, Z_STR_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
if (path) {
ini_name = zend_string_init("session.cookie_path", sizeof("session.cookie_path") - 1, 0);
- zend_alter_ini_entry(ini_name, path, path_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, path, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
if (domain) {
ini_name = zend_string_init("session.cookie_domain", sizeof("session.cookie_domain") - 1, 0);
- zend_alter_ini_entry(ini_name, domain, domain_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, domain, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
if (argc > 3) {
ini_name = zend_string_init("session.cookie_secure", sizeof("session.cookie_secure") - 1, 0);
- zend_alter_ini_entry(ini_name, secure ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry_chars(ini_name, secure ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
if (argc > 4) {
ini_name = zend_string_init("session.cookie_httponly", sizeof("session.cookie_httponly") - 1, 0);
- zend_alter_ini_entry(ini_name, httponly ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry_chars(ini_name, httponly ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
}
@@ -1706,11 +1705,10 @@ static PHP_FUNCTION(session_get_cookie_params)
Return the current session name. If newname is given, the session name is replaced with newname */
static PHP_FUNCTION(session_name)
{
- char *name = NULL;
- size_t name_len;
+ zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
@@ -1718,7 +1716,7 @@ static PHP_FUNCTION(session_name)
if (name) {
ini_name = zend_string_init("session.name", sizeof("session.name") - 1, 0);
- zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
}
@@ -1728,11 +1726,10 @@ static PHP_FUNCTION(session_name)
Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname */
static PHP_FUNCTION(session_module_name)
{
- char *name = NULL;
- size_t name_len;
+ zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
@@ -1744,8 +1741,8 @@ static PHP_FUNCTION(session_module_name)
}
if (name) {
- if (!_php_find_ps_module(name TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find named PHP session module (%s)", name);
+ if (!_php_find_ps_module(name->val TSRMLS_CC)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find named PHP session module (%s)", name->val);
zval_dtor(return_value);
RETURN_FALSE;
@@ -1756,7 +1753,7 @@ static PHP_FUNCTION(session_module_name)
PS(mod_data) = NULL;
ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
- zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
}
@@ -1769,7 +1766,7 @@ static PHP_FUNCTION(session_set_save_handler)
zval *args = NULL;
int i, num_args, argc = ZEND_NUM_ARGS();
zend_string *name;
- zend_string *ini_name;
+ zend_string *ini_name, *ini_val;
if (PS(session_status) != php_session_none) {
RETURN_FALSE;
@@ -1843,7 +1840,9 @@ static PHP_FUNCTION(session_set_save_handler)
if (PS(mod) && PS(session_status) == php_session_none && PS(mod) != &ps_mod_user) {
ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
- zend_alter_ini_entry(ini_name, "user", sizeof("user") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ ini_val = zend_string_init("user", sizeof("user") - 1, 0);
+ zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_val);
zend_string_release(ini_name);
}
@@ -1873,7 +1872,9 @@ static PHP_FUNCTION(session_set_save_handler)
if (PS(mod) && PS(mod) != &ps_mod_user) {
ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
- zend_alter_ini_entry(ini_name, "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ ini_val = zend_string_init("user", sizeof("user") - 1, 0);
+ zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string_release(ini_val);
zend_string_release(ini_name);
}
@@ -1892,24 +1893,23 @@ static PHP_FUNCTION(session_set_save_handler)
Return the current save path passed to module_name. If newname is given, the save path is replaced with newname */
static PHP_FUNCTION(session_save_path)
{
- char *name = NULL;
- size_t name_len;
+ zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &name) == FAILURE) {
return;
}
RETVAL_STRING(PS(save_path));
if (name) {
- if (memchr(name, '\0', name_len) != NULL) {
+ if (memchr(name->val, '\0', name->len) != NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The save_path cannot contain NULL characters");
zval_dtor(return_value);
RETURN_FALSE;
}
ini_name = zend_string_init("session.save_path", sizeof("session.save_path") - 1, 0);
- zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
}
@@ -1990,11 +1990,10 @@ static PHP_FUNCTION(session_regenerate_id)
Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */
static PHP_FUNCTION(session_cache_limiter)
{
- char *limiter = NULL;
- size_t limiter_len;
+ zend_string *limiter = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &limiter, &limiter_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &limiter) == FAILURE) {
return;
}
@@ -2002,7 +2001,7 @@ static PHP_FUNCTION(session_cache_limiter)
if (limiter) {
ini_name = zend_string_init("session.cache_limiter", sizeof("session.cache_limiter") - 1, 0);
- zend_alter_ini_entry(ini_name, limiter, limiter_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, limiter, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
}
@@ -2024,7 +2023,7 @@ static PHP_FUNCTION(session_cache_expire)
if (expires) {
convert_to_string_ex(expires);
ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
- zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRLEN_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ zend_alter_ini_entry(ini_name, Z_STR_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
zend_string_release(ini_name);
}
}
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index a78b9ddeaf..554957d512 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -479,7 +479,7 @@ ZEND_INI_MH(OnUpdateCacheMode)
p = (char*) (base+(size_t) mh_arg1);
- *p = (char)atoi(new_value);
+ *p = (char)atoi(new_value->val);
return SUCCESS;
}
@@ -490,19 +490,19 @@ static PHP_INI_MH(OnUpdateCacheDir)
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
char *p;
- if (memchr(new_value, '\0', new_value_length) != NULL) {
+ if (memchr(new_value->val, '\0', new_value->len) != NULL) {
return FAILURE;
}
/* we do not use zend_memrchr() since path can contain ; itself */
- if ((p = strchr(new_value, ';'))) {
+ if ((p = strchr(new_value->val, ';'))) {
char *p2;
p++;
if ((p2 = strchr(p, ';'))) {
p = p2 + 1;
}
} else {
- p = new_value;
+ p = new_value->val;
}
if (PG(open_basedir) && *p && php_check_open_basedir(p TSRMLS_CC)) {
@@ -510,7 +510,7 @@ static PHP_INI_MH(OnUpdateCacheDir)
}
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
return SUCCESS;
}
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 80ea740100..50babfa1d4 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -58,17 +58,17 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
zval_ptr_dtor(&ASSERTG(callback));
ZVAL_UNDEF(&ASSERTG(callback));
}
- if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value_length)) {
- ZVAL_STRINGL(&ASSERTG(callback), new_value, new_value_length);
+ if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value->len)) {
+ ZVAL_STRINGL(&ASSERTG(callback), new_value->val, new_value->len);
}
} else {
if (ASSERTG(cb)) {
pefree(ASSERTG(cb), 1);
}
- if (new_value && new_value_length) {
- ASSERTG(cb) = pemalloc(new_value_length + 1, 1);
- memcpy(ASSERTG(cb), new_value, new_value_length);
- ASSERTG(cb)[new_value_length] = '\0';
+ if (new_value && new_value->len) {
+ ASSERTG(cb) = pemalloc(new_value->len + 1, 1);
+ memcpy(ASSERTG(cb), new_value->val, new_value->len);
+ ASSERTG(cb)[new_value->len] = '\0';
} else {
ASSERTG(cb) = NULL;
}
@@ -272,7 +272,7 @@ PHP_FUNCTION(assert_options)
if (ac == 2) {
zend_string *value_str = zval_get_string(value);
key = zend_string_init("assert.active", sizeof("assert.active")-1, 0);
- zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
zend_string_release(key);
zend_string_release(value_str);
}
@@ -284,7 +284,7 @@ PHP_FUNCTION(assert_options)
if (ac == 2) {
zend_string *value_str = zval_get_string(value);
key = zend_string_init("assert.bail", sizeof("assert.bail")-1, 0);
- zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
zend_string_release(key);
zend_string_release(value_str);
}
@@ -296,7 +296,7 @@ PHP_FUNCTION(assert_options)
if (ac == 2) {
zend_string *value_str = zval_get_string(value);
key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0);
- zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
zend_string_release(key);
zend_string_release(value_str);
}
@@ -308,7 +308,7 @@ PHP_FUNCTION(assert_options)
if (ac == 2) {
zend_string *value_str = zval_get_string(value);
key = zend_string_init("assert.warning", sizeof("assert.warning")-1, 0);
- zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
zend_string_release(key);
zend_string_release(value_str);
}
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 5cb8aa905a..4ecf4ecbcc 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -5234,27 +5234,30 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze
array_init(&option);
if (ini_entry->orig_value) {
- add_assoc_stringl(&option, "global_value", ini_entry->orig_value, ini_entry->orig_value_length);
+ add_assoc_stringl(&option, "global_value", ini_entry->orig_value->val, ini_entry->orig_value->len);
} else if (ini_entry->value) {
- add_assoc_stringl(&option, "global_value", ini_entry->value, ini_entry->value_length);
+ add_assoc_stringl(&option, "global_value", ini_entry->value->val, ini_entry->value->len);
} else {
add_assoc_null(&option, "global_value");
}
if (ini_entry->value) {
- add_assoc_stringl(&option, "local_value", ini_entry->value, ini_entry->value_length);
+ add_assoc_stringl(&option, "local_value", ini_entry->value->val, ini_entry->value->len);
} else {
add_assoc_null(&option, "local_value");
}
add_assoc_long(&option, "access", ini_entry->modifiable);
- add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, &option);
+ zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &option);
} else {
if (ini_entry->value) {
- add_assoc_stringl(ini_array, ini_entry->name, ini_entry->value, ini_entry->value_length);
+ zval zv;
+
+ ZVAL_STR(&zv, ini_entry->value);
+ zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &zv);
} else {
- add_assoc_null(ini_array, ini_entry->name);
+ zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &EG(uninitialized_zval));
}
}
}
@@ -5305,11 +5308,10 @@ static int php_ini_check_path(char *option_name, int option_len, char *new_optio
PHP_FUNCTION(ini_set)
{
zend_string *varname;
- char *new_value;
- size_t new_value_len;
+ zend_string *new_value;
char *old_value;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss", &varname, &new_value, &new_value_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &varname, &new_value) == FAILURE) {
return;
}
@@ -5331,14 +5333,14 @@ PHP_FUNCTION(ini_set)
_CHECK_PATH(varname->val, varname->len, "mail.log") ||
_CHECK_PATH(varname->val, varname->len, "java.library.path") ||
_CHECK_PATH(varname->val, varname->len, "vpopmail.directory")) {
- if (php_check_open_basedir(new_value TSRMLS_CC)) {
+ if (php_check_open_basedir(new_value->val TSRMLS_CC)) {
zval_dtor(return_value);
RETURN_FALSE;
}
}
}
- if (zend_alter_ini_entry_ex(varname, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
+ if (zend_alter_ini_entry_ex(varname, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
zval_dtor(return_value);
RETURN_FALSE;
}
@@ -5363,12 +5365,11 @@ PHP_FUNCTION(ini_restore)
Sets the include_path configuration option */
PHP_FUNCTION(set_include_path)
{
- char *new_value;
- size_t new_value_len;
+ zend_string *new_value;
char *old_value;
zend_string *key;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &new_value, &new_value_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &new_value) == FAILURE) {
return;
}
@@ -5381,7 +5382,7 @@ PHP_FUNCTION(set_include_path)
}
key = zend_string_init("include_path", sizeof("include_path") - 1, 0);
- if (zend_alter_ini_entry_ex(key, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
+ if (zend_alter_ini_entry_ex(key, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) {
zend_string_release(key);
zval_dtor(return_value);
RETURN_FALSE;
@@ -5471,11 +5472,10 @@ PHP_FUNCTION(connection_status)
Set whether we want to ignore a user abort event or not */
PHP_FUNCTION(ignore_user_abort)
{
- char *arg = NULL;
- size_t arg_len = 0;
+ zend_string *arg = NULL;
int old_setting;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &arg) == FAILURE) {
return;
}
@@ -5483,7 +5483,7 @@ PHP_FUNCTION(ignore_user_abort)
if (arg) {
zend_string *key = zend_string_init("ignore_user_abort", sizeof("ignore_user_abort"), 0);
- zend_alter_ini_entry_ex(key, arg, arg_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
+ zend_alter_ini_entry_ex(key, arg, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
zend_string_release(key);
}
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index cc8a01f4f4..c65d0c55c8 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -296,7 +296,7 @@ PHP_INI_MH(OnChangeBrowscap)
if (bdata->filename[0] != '\0') {
browscap_bdata_dtor(bdata, 0 TSRMLS_CC);
}
- if (VCWD_REALPATH(new_value, bdata->filename) == NULL) {
+ if (VCWD_REALPATH(new_value->val, bdata->filename) == NULL) {
return FAILURE;
}
return SUCCESS;
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index 48910515f7..1f085f9c77 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -58,7 +58,7 @@ static PHP_INI_MH(OnUpdateTags)
ctx = &BG(url_adapt_state_ex);
- tmp = estrndup(new_value, new_value_length);
+ tmp = estrndup(new_value->val, new_value->len);
if (ctx->tags)
zend_hash_destroy(ctx->tags);
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index cfee6c31a7..a2cb7ff8d9 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -56,7 +56,7 @@ static PHP_INI_MH(OnUpdateTags)
ctx = &BG(url_adapt_state_ex);
- tmp = estrndup(new_value, new_value_length);
+ tmp = estrndup(new_value->val, new_value->len);
if (ctx->tags)
zend_hash_destroy(ctx->tags);
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 820715ca05..7fdf6087b4 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -1080,14 +1080,14 @@ static PHP_INI_MH(php_tidy_set_clean_output)
int status;
zend_bool value;
- if (new_value_length==2 && strcasecmp("on", new_value)==0) {
+ if (new_value->len==2 && strcasecmp("on", new_value->val)==0) {
value = (zend_bool) 1;
- } else if (new_value_length==3 && strcasecmp("yes", new_value)==0) {
+ } else if (new_value->len==3 && strcasecmp("yes", new_value->val)==0) {
value = (zend_bool) 1;
- } else if (new_value_length==4 && strcasecmp("true", new_value)==0) {
+ } else if (new_value->len==4 && strcasecmp("true", new_value->val)==0) {
value = (zend_bool) 1;
} else {
- value = (zend_bool) atoi(new_value);
+ value = (zend_bool) atoi(new_value->val);
}
if (stage == PHP_INI_STAGE_RUNTIME) {
@@ -1103,7 +1103,7 @@ static PHP_INI_MH(php_tidy_set_clean_output)
}
}
- status = OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ status = OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
if (stage == PHP_INI_STAGE_RUNTIME && value) {
if (!php_output_handler_started(ZEND_STRL("ob_tidyhandler") TSRMLS_CC)) {
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 20346c04e3..b56038dc53 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -863,22 +863,28 @@ static const zend_function_entry php_zlib_functions[] = {
/* {{{ OnUpdate_zlib_output_compression */
static PHP_INI_MH(OnUpdate_zlib_output_compression)
{
- int status, int_value;
+ int int_value;
char *ini_value;
+ zend_long *p;
+#ifndef ZTS
+ char *base = (char *) mh_arg2;
+#else
+ char *base;
+
+ base = (char *) ts_resource(*((int *) mh_arg2));
+#endif
if (new_value == NULL) {
return FAILURE;
}
- if (!strncasecmp(new_value, "off", sizeof("off"))) {
- new_value = "0";
- new_value_length = sizeof("0");
- } else if (!strncasecmp(new_value, "on", sizeof("on"))) {
- new_value = "1";
- new_value_length = sizeof("1");
+ if (!strncasecmp(new_value->val, "off", sizeof("off"))) {
+ int_value = 0;
+ } else if (!strncasecmp(new_value->val, "on", sizeof("on"))) {
+ int_value = 1;
+ } else {
+ int_value = zend_atoi(new_value->val, new_value->len);
}
-
- int_value = zend_atoi(new_value, new_value_length);
ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0);
if (ini_value && *ini_value && int_value) {
@@ -886,14 +892,15 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
return FAILURE;
}
if (stage == PHP_INI_STAGE_RUNTIME) {
- status = php_output_get_status(TSRMLS_C);
+ int status = php_output_get_status(TSRMLS_C);
if (status & PHP_OUTPUT_SENT) {
php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "Cannot change zlib.output_compression - headers already sent");
return FAILURE;
}
}
- status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ p = (zend_long *) (base+(size_t) mh_arg1);
+ *p = int_value;
ZLIBG(output_compression) = ZLIBG(output_compression_default);
if (stage == PHP_INI_STAGE_RUNTIME && int_value) {
@@ -902,7 +909,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
}
}
- return status;
+ return SUCCESS;
}
/* }}} */
@@ -914,7 +921,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_handler)
return FAILURE;
}
- return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
/* }}} */