Skip to content

Commit 3de0ba7

Browse files
committed
Merge branch 'PHP-7.3'
* PHP-7.3: Fixed bug #76850 Exit code mangled by set locale/preg_match
2 parents a303089 + c6ddd45 commit 3de0ba7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/pcre/php_pcre.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
729729
if (key != regex) {
730730
tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(locale_string));
731731
if (!tables) {
732+
zend_string *_k;
732733
tables = pcre2_maketables(gctx);
733734
if (UNEXPECTED(!tables)) {
734735
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)
737738
efree(pattern);
738739
return NULL;
739740
}
740-
zend_hash_add_ptr(&char_tables, BG(locale_string), (void *)tables);
741+
_k = zend_string_dup(BG(locale_string), 1);
742+
zend_hash_add_ptr(&char_tables, _k, (void *)tables);
743+
zend_string_release(_k);
741744
}
742745
pcre2_set_character_tables(cctx, tables);
743746
}

0 commit comments

Comments
 (0)