summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-12-19 12:51:38 +0100
committerAnatol Belski <ab@php.net>2017-12-19 12:57:39 +0100
commit0994e373f21c1b4c63d38975f0c62866f0378113 (patch)
tree5b5816af334e2cdc829ca2abf104e5d4d1658722
parent80571d6f967c879a5f1c457fbc51092df5d131a4 (diff)
downloadphp-git-0994e373f21c1b4c63d38975f0c62866f0378113.tar.gz
Compile the blacklist pattern with JIT
There are certain limitations on the pattern size. Should the JIT compilation fail, the interpreter code is still usable.
-rw-r--r--ext/opcache/zend_accelerator_blacklist.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c
index 46d50cf96d..8b8c9b0d37 100644
--- a/ext/opcache/zend_accelerator_blacklist.c
+++ b/ext/opcache/zend_accelerator_blacklist.c
@@ -184,6 +184,13 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist)
blacklist_report_regexp_error((char *)pcre_error, pcre_error_offset);
return;
}
+#ifdef HAVE_PCRE_JIT_SUPPORT
+ if (0 > pcre2_jit_compile(it->re, PCRE2_JIT_COMPLETE)) {
+ /* Don't return here, even JIT could fail to compile, the pattern is still usable. */
+ pcre2_get_error_message(errnumber, pcre_error, sizeof(pcre_error));
+ zend_accel_error(ACCEL_LOG_WARNING, "Blacklist JIT compilation failed, %s\n", pcre_error);
+ }
+#endif
/* prepare for the next iteration */
p = regexp + 2;
*regexp_list_it = it;