summaryrefslogtreecommitdiff
path: root/ext/mbstring/php_mbregex.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-06-16 14:31:29 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-06-16 14:31:29 +0200
commit3f2f36d5d4c5c3c77703b366a5c7f9c3682727ee (patch)
tree9e2ec2b1d122a3cc17bea670ebb325416a06acc2 /ext/mbstring/php_mbregex.c
parent59e343c77909626ce70adf9e470a09bc8e982aae (diff)
downloadphp-git-3f2f36d5d4c5c3c77703b366a5c7f9c3682727ee.tar.gz
Fix non-default syntax in mb_ereg_search()
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r--ext/mbstring/php_mbregex.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 882978479e..76aff4f244 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -1426,7 +1426,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
size_t arg_pattern_len, arg_options_len;
int err;
size_t n, i, pos, len, beg, end;
- OnigOptionType option;
+ OnigOptionType option = 0;
OnigUChar *str;
OnigSyntaxType *syntax;
@@ -1434,11 +1434,11 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
return;
}
- option = MBREX(regex_default_options);
-
if (arg_options) {
- option = 0;
_php_mb_regex_init_options(arg_options, arg_options_len, &option, &syntax, NULL);
+ } else {
+ option |= MBREX(regex_default_options);
+ syntax = MBREX(regex_default_syntax);
}
if (MBREX(search_regs)) {
@@ -1448,7 +1448,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (arg_pattern) {
/* create regex pattern buffer */
- if ((MBREX(search_re) = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(current_mbctype), MBREX(regex_default_syntax))) == NULL) {
+ if ((MBREX(search_re) = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(current_mbctype), syntax)) == NULL) {
RETURN_FALSE;
}
}