]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4'
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 16 Jun 2020 12:32:33 +0000 (14:32 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 16 Jun 2020 12:32:33 +0000 (14:32 +0200)
1  2 
ext/mbstring/php_mbregex.c

index bc365969884b0a4734c7e17d60590dbec2756b16,76aff4f244e43685fb50d5e222104cf5d949f641..c614b0d5a46c632a9e728d0a3069f6b274183d38
@@@ -1354,22 -1425,20 +1354,22 @@@ _php_mb_regex_ereg_search_exec(INTERNAL
        char *arg_pattern = NULL, *arg_options = NULL;
        size_t arg_pattern_len, arg_options_len;
        int err;
 -      size_t n, i, pos, len, beg, end;
 +      size_t n, i, pos, len;
 +      /* Stored as int* in the OnigRegion struct */
 +      int beg, end;
-       OnigOptionType option;
+       OnigOptionType option = 0;
        OnigUChar *str;
        OnigSyntaxType *syntax;
  
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ss", &arg_pattern, &arg_pattern_len, &arg_options, &arg_options_len) == FAILURE) {
 -              return;
 +              RETURN_THROWS();
        }
  
-       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)) {
  
        if (arg_pattern) {
                /* create regex pattern buffer */
-               if ((MBREX(search_re) = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(regex_default_syntax))) == NULL) {
 -              if ((MBREX(search_re) = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(current_mbctype), syntax)) == NULL) {
++              if ((MBREX(search_re) = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, syntax)) == NULL) {
                        RETURN_FALSE;
                }
        }