summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-10-04 16:04:42 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-10-04 16:04:42 +0200
commit43358cc7b659a4a1ff237c127ea5fd7c85cc5486 (patch)
treecba282e4d25e178dda377aba0e5bb097c3d275b3 /ext/pcre/php_pcre.c
parent487e6e9eca5d9e386bd5bfca3a0b141a08e3c044 (diff)
parent01b3cc4dee5e9fa4750e1a8d5635758fdae19cab (diff)
downloadphp-git-43358cc7b659a4a1ff237c127ea5fd7c85cc5486.tar.gz
Merge branch 'PHP-7.4'
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index a156d37494..752b5b73a5 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -781,6 +781,12 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
if (!pcre2_pattern_info(re, PCRE2_INFO_JITSIZE, &jit_size) && jit_size > 0) {
poptions |= PREG_JIT;
}
+ } else if (rc == PCRE2_ERROR_NOMEMORY) {
+ php_error_docref(NULL, E_WARNING,
+ "Allocation of JIT memory failed, PCRE JIT will be disabled. "
+ "This is likely caused by security restrictions. "
+ "Either grant PHP permission to allocate executable memory, or set pcre.jit=0");
+ PCRE_G(jit) = 0;
} else {
pcre2_get_error_message(rc, error, sizeof(error));
php_error_docref(NULL, E_WARNING, "JIT compilation failed: %s", error);