summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-11-21 20:10:49 +0100
committerAnatol Belski <ab@php.net>2017-11-21 20:10:49 +0100
commitf5c0754f6e235c54ccee03c520969ee75723c83d (patch)
tree242592b999153d4a084536749c47342c5c3707c5 /ext/pcre/php_pcre.c
parentd773a92f3c49c3f17079153d7bd9b44462266996 (diff)
parent8fdef981ef940dfc2f1b21cfa3f227150472ad2d (diff)
downloadphp-git-f5c0754f6e235c54ccee03c520969ee75723c83d.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: 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 2a28b9c3b3..c0a6a848b6 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -356,6 +356,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;
}
@@ -369,6 +370,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;
}
@@ -419,6 +421,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;
}
@@ -467,6 +470,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) {
@@ -497,6 +501,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
#endif
php_error_docref(NULL,E_WARNING, "Compilation failed: %s at offset %d", error, erroffset);
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
efree(pattern);
if (tables) {
pefree((void*)tables, 1);
@@ -528,6 +533,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
if (error != NULL) {
php_error_docref(NULL, E_WARNING, "Error while studying pattern");
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
}
} else {
extra = NULL;
@@ -564,6 +570,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
#endif
php_error_docref(NULL, E_WARNING, "Internal pcre_fullinfo() error %d", rc);
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
return NULL;
}
@@ -575,6 +582,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
}
#endif
php_error_docref(NULL, E_WARNING, "Internal pcre_fullinfo() error %d", rc);
+ pcre_handle_exec_error(PCRE_ERROR_INTERNAL);
return NULL;
}