summaryrefslogtreecommitdiff
path: root/ext/mbstring/php_mbregex.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2019-03-30 14:52:04 -0700
committerStanislav Malyshev <stas@php.net>2019-03-30 23:18:33 -0700
commite12c069d33fef2e0b2a8009e1cd4bc4fc2206e67 (patch)
tree79f011eede267ff5b5dbc3b4b4d28e5c6381c968 /ext/mbstring/php_mbregex.c
parentbc4cb277d3ddaecee8285b98d248380b454edbfd (diff)
downloadphp-git-e12c069d33fef2e0b2a8009e1cd4bc4fc2206e67.tar.gz
Add fallbacks for older oniguruma versions
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r--ext/mbstring/php_mbregex.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 10c7f3e272..75b00f547c 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -34,6 +34,18 @@
#include <oniguruma.h>
#undef UChar
+#if ONIGURUMA_VERSION_INT < 60800
+typedef void OnigMatchParam;
+#define onig_new_match_param() (NULL)
+#define onig_initialize_match_param(x)
+#define onig_set_match_stack_limit_size_of_match_param(x, y)
+#define onig_free_match_param(x)
+#define onig_search_with_param(reg, str, end, start, range, region, option, mp) \
+ onig_search(reg, str, end, start, range, region, option)
+#define onig_match_with_param(re, str, end, at, region, option, mp) \
+ onig_match(re, str, end, at, region, option)
+#endif
+
ZEND_EXTERN_MODULE_GLOBALS(mbstring)
struct _zend_mb_regex_globals {
@@ -856,7 +868,7 @@ static int _php_mb_onig_search(regex_t* reg, const OnigUChar* str, const OnigUCh
OnigMatchParam *mp = onig_new_match_param();
int err;
onig_initialize_match_param(mp);
- if(MBSTRG(regex_stack_limit) > 0 && MBSTRG(regex_stack_limit) < UINT_MAX) {
+ if (!ZEND_LONG_UINT_OVFL(MBSTRG(regex_stack_limit))) {
onig_set_match_stack_limit_size_of_match_param(mp, (unsigned int)MBSTRG(regex_stack_limit));
}
/* search */