com php-src: Fixed bug #76850 Exit code mangled by set locale/preg_match: ext/pcre/php_pcre.c
| From: | Anatol Belski | Date: | Sat, 08 Sep 2018 19:35:23 +0000 |
| Subject: | com php-src: Fixed bug #76850 Exit code mangled by set locale/preg_match: ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-103029@lists.php.net to get a copy of this message | ||
Commit: c6ddd45650c295bdf800c600e89a15c0af9a1e09
Author: Anatol Belski <ab@php.net> Sat, 8 Sep 2018 21:35:23 +0200
Parents: 58e2f5ead162280e124d41c9b9bc2e9cb3660b06
Branches: PHP-7.3 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c6ddd45650c295bdf800c600e89a15c0af9a1e09
Log:
Fixed bug #76850 Exit code mangled by set locale/preg_match
Bugs:
https://bugs.php.net/76850
Changed paths:
M ext/pcre/php_pcre.c
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index b9213d4..3910b41 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -729,6 +729,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
if (key != regex) {
tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(locale_string));
if (!tables) {
+ zend_string *_k;
tables = pcre2_maketables(gctx);
if (UNEXPECTED(!tables)) {
php_error_docref(NULL,E_WARNING, "Failed to generate locale character tables");
@@ -737,7 +738,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
efree(pattern);
return NULL;
}
- zend_hash_add_ptr(&char_tables, BG(locale_string), (void *)tables);
+ _k = zend_string_dup(BG(locale_string), 1);
+ zend_hash_add_ptr(&char_tables, _k, (void *)tables);
+ zend_string_release(_k);
}
pcre2_set_character_tables(cctx, tables);
}