summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-11-21 20:15:30 +0100
committerAnatol Belski <ab@php.net>2017-11-21 20:15:30 +0100
commit54e7b0a6f77badba4385aabea6ebb656817df4f4 (patch)
tree2587035169755aac1cce85aff4db550d0e7d0bf4 /ext/pcre/php_pcre.c
parent12b2c2f5f9f3f31f6276aac35365932d9032e839 (diff)
parentf6b0d365a709ae71cd9f77b25c337a6e6883f68d (diff)
downloadphp-git-54e7b0a6f77badba4385aabea6ebb656817df4f4.tar.gz
Merge branch 'PHP-7.2'
* PHP-7.2: Fixed #75539 and #74183 - preg_last_error not returning error code after error
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index f23202ba18..fd9f20d4a3 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -558,6 +558,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
#endif
php_error_docref(NULL, E_WARNING,
p < ZSTR_VAL(regex) + ZSTR_LEN(regex) ? "Null byte in regex" : "Empty regular expression");
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
return NULL;
}
@@ -571,6 +572,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
#endif
php_error_docref(NULL,E_WARNING, "Delimiter must not be alphanumeric or backslash");
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
return NULL;
}
@@ -621,6 +623,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
} else {
php_error_docref(NULL,E_WARNING, "No ending matching delimiter '%c' found", delimiter);
}
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
return NULL;
}
@@ -670,6 +673,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
} else {
php_error_docref(NULL,E_WARNING, "Null byte in regex");
}
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
efree(pattern);
#if HAVE_SETLOCALE
if (key != regex) {
@@ -714,6 +718,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
#endif
pcre2_get_error_message(errnumber, error, sizeof(error));
php_error_docref(NULL,E_WARNING, "Compilation failed: %s at offset %zu", error, erroffset);
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
efree(pattern);
if (tables) {
pefree((void*)tables, 1);
@@ -733,6 +738,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
} else {
pcre2_get_error_message(rc, error, sizeof(error));
php_error_docref(NULL, E_WARNING, "JIT compilation failed: %s", error);
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
}
}
#endif
@@ -766,6 +772,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
#endif
php_error_docref(NULL, E_WARNING, "Internal pcre2_pattern_info() error %d", rc);
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
return NULL;
}
@@ -777,6 +784,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
#endif
php_error_docref(NULL, E_WARNING, "Internal pcre_pattern_info() error %d", rc);
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
return NULL;
}