From: Dmitry Stogov Date: Tue, 2 Sep 2014 07:24:52 +0000 (+0400) Subject: fixed reference counting X-Git-Tag: PRE_PHP7_REMOVALS~154 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e51677b2e6ce72a3c1325e14ff932720f5b5d523;p=php fixed reference counting --- diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 81978850ee..4cafd02982 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -243,6 +243,9 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) ini_name = zend_string_init(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0); zend_alter_ini_entry(ini_name, locale_name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); zend_string_release(ini_name); + if (default_locale != NULL) { + zend_string_release(locale_name); + } RETURN_TRUE; } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index a2c88044fd..ad6a2fb841 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -5280,7 +5280,7 @@ static int _addinientry(zval *el TSRMLS_DC, int num_args, va_list args, zend_has if (ini_entry->value) { zval zv; - ZVAL_STR(&zv, ini_entry->value); + ZVAL_STR(&zv, zend_string_copy(ini_entry->value)); zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &zv); } else { zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &EG(uninitialized_zval)); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 2f5c5b651e..b45db8a9b4 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5254,7 +5254,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze if (ini_entry->value) { zval zv; - ZVAL_STR(&zv, ini_entry->value); + ZVAL_STR(&zv, zend_string_copy(ini_entry->value)); zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &zv); } else { zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &EG(uninitialized_zval)); diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c index a78b8dc913..04ff6e5d30 100644 --- a/sapi/apache/mod_php5.c +++ b/sapi/apache/mod_php5.c @@ -567,7 +567,7 @@ static void init_request_info(TSRMLS_D) static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry TSRMLS_DC) { zend_string *key = STR_INIT(per_dir_entry->key, per_dir_entry->key_length, 0); - zend_alter_ini_entry(key, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, per_dir_entry->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry_chars(key, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, per_dir_entry->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE); STR_RELEASE(key); return 0; } diff --git a/win32/registry.c b/win32/registry.c index 8ed838b1d1..10372cd624 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -244,7 +244,7 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC) zval *data; ZEND_HASH_FOREACH_KEY_VAL(ht, num, index, data) { - zend_alter_ini_entry(index, Z_STRVAL_P(data), Z_STRLEN_P(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(index, Z_STR_P(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } ZEND_HASH_FOREACH_END(); /* for (zend_hash_internal_pointer_reset_ex(ht, &pos);