diff --git a/main/php_ini.c b/main/php_ini.c index 79aa9f27585..fd6f3664882 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -782,7 +782,17 @@ PHPAPI int php_parse_user_ini_file(const char *dirname, const char *ini_filename /* Reset active ini section */ RESET_ACTIVE_INI_HASH(); +#if ZEND_RC_DEBUG + /* User inis are parsed during SAPI activate (part of the request), + * but persistently allocated to allow caching. This is fine as long as + * strings are duplicated in php_ini_activate_config(). */ + bool orig_rc_debug = zend_rc_debug; + zend_rc_debug = false; +#endif ret = zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, target_hash); +#if ZEND_RC_DEBUG + zend_rc_debug = orig_rc_debug; +#endif if (ret == SUCCESS) { /* FIXME: Add parsed file to the list of user files read? */ } @@ -803,7 +813,9 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int /* Walk through config hash and alter matching ini entries using the values found in the hash */ ZEND_HASH_FOREACH_STR_KEY_VAL(source_hash, str, data) { - zend_alter_ini_entry_ex(str, Z_STR_P(data), modify_type, stage, 0); + zend_string *data_str = zend_string_dup(Z_STR_P(data), 0); + zend_alter_ini_entry_ex(str, data_str, modify_type, stage, 0); + zend_string_release(data_str); } ZEND_HASH_FOREACH_END(); } /* }}} */