From: Dmitry Stogov Date: Tue, 2 Sep 2014 05:52:23 +0000 (+0400) Subject: Avoid string duplication X-Git-Tag: PRE_PHP7_REMOVALS~155 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1670772dc606079088357ce1c9a0c4293cd7b3d9;p=php Avoid string duplication --- diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 50babfa1d4..94fee5a1ce 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -59,7 +59,7 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */ ZVAL_UNDEF(&ASSERTG(callback)); } if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value->len)) { - ZVAL_STRINGL(&ASSERTG(callback), new_value->val, new_value->len); + ZVAL_STR(&ASSERTG(callback), zend_string_copy(new_value)); } } else { if (ASSERTG(cb)) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 4ecf4ecbcc..2f5c5b651e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5234,15 +5234,15 @@ 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->val, ini_entry->orig_value->len); + add_assoc_str(&option, "global_value", zend_string_copy(ini_entry->orig_value)); } else if (ini_entry->value) { - add_assoc_stringl(&option, "global_value", ini_entry->value->val, ini_entry->value->len); + add_assoc_str(&option, "global_value", zend_string_copy(ini_entry->value)); } else { add_assoc_null(&option, "global_value"); } if (ini_entry->value) { - add_assoc_stringl(&option, "local_value", ini_entry->value->val, ini_entry->value->len); + add_assoc_str(&option, "local_value", zend_string_copy(ini_entry->value)); } else { add_assoc_null(&option, "local_value"); }