summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index e46c83accc..c365c9f475 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -720,6 +720,13 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(locale_string));
if (!tables) {
tables = pcre2_maketables(gctx);
+ if (UNEXPECTED(!tables)) {
+ php_error_docref(NULL,E_WARNING, "Failed to generate locale character tables");
+ pcre_handle_exec_error(PCRE2_ERROR_NOMEMORY);
+ zend_string_release_ex(key, 0);
+ efree(pattern);
+ return NULL;
+ }
zend_hash_add_ptr(&char_tables, BG(locale_string), (void *)tables);
}
pcre2_set_character_tables(cctx, tables);