diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-12-23 14:38:30 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-12-23 14:38:30 +0300 |
commit | 7624fb6e8b16f1517ec451ae0880b48f524c4972 (patch) | |
tree | e5d758bc14dd6e098cdff3dae03c9455587411ed /ext/pcre/php_pcre.c | |
parent | 62e29736023e7d555736501cd05f31463394babb (diff) | |
download | php-git-7624fb6e8b16f1517ec451ae0880b48f524c4972.tar.gz |
Fixed possible crash (pcre cache must keep permanent strings)
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index d3eb4d49fe..5701ae1a0c 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -439,7 +439,11 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) new_entry.preg_options = poptions; new_entry.compile_options = coptions; #if HAVE_SETLOCALE - new_entry.locale = BG(locale_string) ? zend_string_dup(BG(locale_string), 1) : NULL; + new_entry.locale = BG(locale_string) ? + ((GC_FLAGS(BG(locale_string)) & IS_STR_PERSISTENT) ? + zend_string_copy(BG(locale_string)) : + zend_string_init(BG(locale_string)->val, BG(locale_string)->len, 1)) : + NULL; new_entry.tables = tables; #endif |