diff options
author | Dmitry Stogov <dmitry@zend.com> | 2015-04-22 02:29:06 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2015-04-22 02:29:06 +0300 |
commit | 770cb1da71656fa0dce7dfab26e5e88cb557b639 (patch) | |
tree | 730e919e37a87fba9302839613fba6bc2ceb9bca /ext/pcre/php_pcre.c | |
parent | c9da004a1884f54ad69b8b66e585f1ba451e84ee (diff) | |
download | php-git-770cb1da71656fa0dce7dfab26e5e88cb557b639.tar.gz |
Keep realpath and PCRE caches in consistency with opcache SHM.
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 4c29905d2f..1f013408fc 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -54,7 +54,7 @@ enum { }; -ZEND_DECLARE_MODULE_GLOBALS(pcre) +PHPAPI ZEND_DECLARE_MODULE_GLOBALS(pcre) static void pcre_handle_exec_error(int pcre_code) /* {{{ */ @@ -482,7 +482,14 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) * as hash keys especually for this table. * See bug #63180 */ - pce = zend_hash_str_update_mem(&PCRE_G(pcre_cache), regex->val, regex->len, &new_entry, sizeof(pcre_cache_entry)); + if (!IS_INTERNED(regex) || !(GC_FLAGS(regex) & IS_STR_PERMANENT)) { + zend_string *str = zend_string_init(regex->val, regex->len, 1); + GC_REFCOUNT(str) = 0; /* will be incremented by zend_hash_update_mem() */ + str->h = regex->h; + regex = str; + } + + pce = zend_hash_update_mem(&PCRE_G(pcre_cache), regex, &new_entry, sizeof(pcre_cache_entry)); return pce; } |