Created
August 11, 2018 12:29
-
-
Save cmb69/a9c65af3a1462ed21b12beace502de0d to your computer and use it in GitHub Desktop.
PCRE warnings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext/pcre/php_pcre.c | 8 +++++++- | |
1 file changed, 7 insertions(+), 1 deletion(-) | |
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c | |
index b9213d4909..9f0c8b23bb 100644 | |
--- a/ext/pcre/php_pcre.c | |
+++ b/ext/pcre/php_pcre.c | |
@@ -112,27 +112,33 @@ static void pcre_handle_exec_error(int pcre_code) /* {{{ */ | |
switch (pcre_code) { | |
case PCRE2_ERROR_MATCHLIMIT: | |
preg_code = PHP_PCRE_BACKTRACK_LIMIT_ERROR; | |
+ php_error_docref(NULL, E_WARNING, "Backtrack limit exhausted"); | |
break; | |
- | |
+ | |
case PCRE2_ERROR_RECURSIONLIMIT: | |
preg_code = PHP_PCRE_RECURSION_LIMIT_ERROR; | |
+ php_error_docref(NULL, E_WARNING, "Recursion limit exhausted"); | |
break; | |
case PCRE2_ERROR_BADUTFOFFSET: | |
preg_code = PHP_PCRE_BAD_UTF8_OFFSET_ERROR; | |
+ php_error_docref(NULL, E_WARNING, "Malformed UTF-8"); | |
break; | |
#ifdef HAVE_PCRE_JIT_SUPPORT | |
case PCRE2_ERROR_JIT_STACKLIMIT: | |
preg_code = PHP_PCRE_JIT_STACKLIMIT_ERROR; | |
+ php_error_docref(NULL, E_WARNING, "JIT stack limit exhausted"); | |
break; | |
#endif | |
default: | |
if (pcre_code <= PCRE2_ERROR_UTF8_ERR1 && pcre_code >= PCRE2_ERROR_UTF8_ERR21) { | |
preg_code = PHP_PCRE_BAD_UTF8_ERROR; | |
+ php_error_docref(NULL, E_WARNING, "Malformed UTF-8"); | |
} else { | |
preg_code = PHP_PCRE_INTERNAL_ERROR; | |
+ php_error_docref(NULL, E_WARNING, "Internal PCRE error"); | |
} | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment