diff options
author | Andrey Hristov <andrey@php.net> | 2012-10-31 15:55:04 +0100 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2012-10-31 15:55:04 +0100 |
commit | f2f380407ac4138a483b43f9649695db36e42c8c (patch) | |
tree | e7048592c57ca7c0822c2cbe47cbf9f9e86679ea /ext/pcre/php_pcre.c | |
parent | d62bc53a4fb2058a06f356b5779a0db88f6e207c (diff) | |
parent | 8fb26e76ba463cfd38433bb2f19be84ff79b11b8 (diff) | |
download | php-git-f2f380407ac4138a483b43f9649695db36e42c8c.tar.gz |
Merge branch 'master' of ssh://git.php.net/php-src
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 6d393a26a7..ab33881f35 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -248,6 +248,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le #endif pcre_cache_entry *pce; pcre_cache_entry new_entry; + char *tmp = NULL; /* Try to lookup the cached regex entry, and if successful, just pass back the compiled pattern, otherwise go on and compile it. */ @@ -438,9 +439,26 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le new_entry.locale = pestrdup(locale, 1); new_entry.tables = tables; #endif + + /* + * Interned strings are not duplicated when stored in HashTable, + * but all the interned strings created during HTTP request are removed + * at end of request. However PCRE_G(pcre_cache) must be consistent + * on the next request as well. So we disable usage of interned strings + * as hash keys especually for this table. + * See bug #63180 + */ + if (IS_INTERNED(regex)) { + regex = tmp = estrndup(regex, regex_len); + } + zend_hash_update(&PCRE_G(pcre_cache), regex, regex_len+1, (void *)&new_entry, sizeof(pcre_cache_entry), (void**)&pce); + if (tmp) { + efree(tmp); + } + return pce; } /* }}} */ |