@@ -1426,19 +1426,19 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
1426
1426
size_t arg_pattern_len , arg_options_len ;
1427
1427
int err ;
1428
1428
size_t n , i , pos , len , beg , end ;
1429
- OnigOptionType option ;
1429
+ OnigOptionType option = 0 ;
1430
1430
OnigUChar * str ;
1431
1431
OnigSyntaxType * syntax ;
1432
1432
1433
1433
if (zend_parse_parameters (ZEND_NUM_ARGS (), "|ss" , & arg_pattern , & arg_pattern_len , & arg_options , & arg_options_len ) == FAILURE ) {
1434
1434
return ;
1435
1435
}
1436
1436
1437
- option = MBREX (regex_default_options );
1438
-
1439
1437
if (arg_options ) {
1440
- option = 0 ;
1441
1438
_php_mb_regex_init_options (arg_options , arg_options_len , & option , & syntax , NULL );
1439
+ } else {
1440
+ option |= MBREX (regex_default_options );
1441
+ syntax = MBREX (regex_default_syntax );
1442
1442
}
1443
1443
1444
1444
if (MBREX (search_regs )) {
@@ -1448,7 +1448,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
1448
1448
1449
1449
if (arg_pattern ) {
1450
1450
/* create regex pattern buffer */
1451
- if ((MBREX (search_re ) = php_mbregex_compile_pattern (arg_pattern , arg_pattern_len , option , MBREX (current_mbctype ), MBREX ( regex_default_syntax ) )) == NULL ) {
1451
+ if ((MBREX (search_re ) = php_mbregex_compile_pattern (arg_pattern , arg_pattern_len , option , MBREX (current_mbctype ), syntax )) == NULL ) {
1452
1452
RETURN_FALSE ;
1453
1453
}
1454
1454
}
0 commit comments