From: Dmitry Stogov Date: Wed, 1 Nov 2017 12:13:49 +0000 (+0300) Subject: PCRE cache is "thread-local" X-Git-Tag: php-7.3.0alpha1~1112^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5664a149260ed4a83aa5cfb13ad11ed18c56af6;p=php PCRE cache is "thread-local" --- diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index ebf84c0c58..743908be50 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -592,17 +592,19 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) * See bug #63180 */ if (!(GC_FLAGS(key) & IS_STR_PERMANENT)) { - pce = zend_hash_str_add_new_mem(&PCRE_G(pcre_cache), - ZSTR_VAL(key), ZSTR_LEN(key), &new_entry, sizeof(pcre_cache_entry)); + zend_string *str = zend_string_init(ZSTR_VAL(key), ZSTR_LEN(key), 1); + + GC_MAKE_PERSISTENT_LOCAL(str); #if HAVE_SETLOCALE if (key != regex) { zend_string_release(key); } #endif - } else { - pce = zend_hash_add_new_mem(&PCRE_G(pcre_cache), key, &new_entry, sizeof(pcre_cache_entry)); + key = str; } + pce = zend_hash_add_new_mem(&PCRE_G(pcre_cache), key, &new_entry, sizeof(pcre_cache_entry)); + return pce; } /* }}} */