Skip to content

Commit bbe74a6

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 77d0587 + 3f2f36d commit bbe74a6

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

ext/mbstring/php_mbregex.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,19 +1357,19 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
13571357
size_t n, i, pos, len;
13581358
/* Stored as int* in the OnigRegion struct */
13591359
int beg, end;
1360-
OnigOptionType option;
1360+
OnigOptionType option = 0;
13611361
OnigUChar *str;
13621362
OnigSyntaxType *syntax;
13631363

13641364
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ss", &arg_pattern, &arg_pattern_len, &arg_options, &arg_options_len) == FAILURE) {
13651365
RETURN_THROWS();
13661366
}
13671367

1368-
option = MBREX(regex_default_options);
1369-
13701368
if (arg_options) {
1371-
option = 0;
13721369
_php_mb_regex_init_options(arg_options, arg_options_len, &option, &syntax, NULL);
1370+
} else {
1371+
option |= MBREX(regex_default_options);
1372+
syntax = MBREX(regex_default_syntax);
13731373
}
13741374

13751375
if (MBREX(search_regs)) {
@@ -1379,7 +1379,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
13791379

13801380
if (arg_pattern) {
13811381
/* create regex pattern buffer */
1382-
if ((MBREX(search_re) = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(regex_default_syntax))) == NULL) {
1382+
if ((MBREX(search_re) = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, syntax)) == NULL) {
13831383
RETURN_FALSE;
13841384
}
13851385
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Specifying non-default syntax in mb_ereg_search()
3+
--FILE--
4+
<?php
5+
6+
mb_ereg_search_init("a");
7+
var_dump(mb_ereg_search("a\\{1,2\\}", "b"));
8+
9+
?>
10+
--EXPECT--
11+
bool(true)

0 commit comments

Comments
 (0)