summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.h
diff options
context:
space:
mode:
authorNicolas Oelgart <nicolas.oelgart@atrapalo.com>2020-02-17 14:29:12 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-25 10:26:03 +0100
commitaa79a22d32f31dbc5343f8191e925aa07447c3ec (patch)
tree85a3cbefa474cb428161242ad54c1631a654c980 /ext/pcre/php_pcre.h
parentbb6e2a1615a54bc2986c782a2541289fd33a1bbb (diff)
downloadphp-git-aa79a22d32f31dbc5343f8191e925aa07447c3ec.tar.gz
Add preg_last_error_msg() function
Provides the last PCRE error as a human-readable message, similar to functionality existing in other extensions, such as json_last_error_msg(). Closes GH-5185.
Diffstat (limited to 'ext/pcre/php_pcre.h')
-rw-r--r--ext/pcre/php_pcre.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index 3c2fff4251..bf78f992fa 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -37,6 +37,16 @@ extern zend_module_entry pcre_module_entry;
typedef struct _pcre_cache_entry pcre_cache_entry;
+typedef enum {
+ PHP_PCRE_NO_ERROR = 0,
+ PHP_PCRE_INTERNAL_ERROR,
+ PHP_PCRE_BACKTRACK_LIMIT_ERROR,
+ PHP_PCRE_RECURSION_LIMIT_ERROR,
+ PHP_PCRE_BAD_UTF8_ERROR,
+ PHP_PCRE_BAD_UTF8_OFFSET_ERROR,
+ PHP_PCRE_JIT_STACKLIMIT_ERROR
+} php_pcre_error_code;
+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware);
@@ -70,7 +80,7 @@ ZEND_BEGIN_MODULE_GLOBALS(pcre)
zend_bool jit;
#endif
zend_bool per_request_cache;
- int error_code;
+ php_pcre_error_code error_code;
/* Used for unmatched subpatterns in OFFSET_CAPTURE mode */
zval unmatched_null_pair;
zval unmatched_empty_pair;