com php-src: Add fallbacks for older oniguruma versions: ext/mbstring/mbstring.c ext/mbstring/php_mbregex.c

From: Date: Sun, 31 Mar 2019 06:18:33 +0000
Subject: com php-src: Add fallbacks for older oniguruma versions: ext/mbstring/mbstring.c ext/mbstring/php_mbregex.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-105447@lists.php.net to get a copy of this message
Commit: e12c069d33fef2e0b2a8009e1cd4bc4fc2206e67 Author: Stanislav Malyshev <stas@php.net> Sat, 30 Mar 2019 14:52:04 -0700 Parents: bc4cb277d3ddaecee8285b98d248380b454edbfd Branches: PHP-7.3 PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e12c069d33fef2e0b2a8009e1cd4bc4fc2206e67 Log: Add fallbacks for older oniguruma versions Changed paths: M ext/mbstring/mbstring.c M ext/mbstring/php_mbregex.c Diff: diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 36b6c47..28ea4bd 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -65,6 +65,17 @@ #include "php_onig_compat.h" #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 #elif HAVE_PCRE || HAVE_BUNDLED_PCRE #include "ext/pcre/php_pcre.h" #endif @@ -1030,7 +1041,7 @@ static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len) 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 */ diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 10c7f3e..75b00f5 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 */

« previous php.cvs (#105447) next »