diff options
author | Dmitry Stogov <dmitry@zend.com> | 2017-11-01 15:13:49 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2017-11-01 15:13:49 +0300 |
commit | f5664a149260ed4a83aa5cfb13ad11ed18c56af6 (patch) | |
tree | 706275a644112091cd58e06679c86d113876916f /ext/pcre/php_pcre.c | |
parent | cf582a32ef961cde0cfc51a0ffafa352d52edde5 (diff) | |
download | php-git-f5664a149260ed4a83aa5cfb13ad11ed18c56af6.tar.gz |
PCRE cache is "thread-local"
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 10 |
1 files changed, 6 insertions, 4 deletions
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; } /* }}} */ |