summaryrefslogtreecommitdiff
path: root/ext/mbstring/php_mbregex.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-03-13 15:48:53 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-03-27 10:34:16 +0100
commit9e77d5a9da9e80a1bfe226f60ccb12fd8bf9481c (patch)
tree14fd42aa401d1a007a0c5ca85382b7eb26015d6a /ext/mbstring/php_mbregex.c
parent150df5b17c371f6e6a552b88435afaca0d1ad096 (diff)
downloadphp-git-9e77d5a9da9e80a1bfe226f60ccb12fd8bf9481c.tar.gz
Fix #76999: mb_regex_set_options() return current options
When setting new options, `mb_regex_set_options()` is supposed to return the *previous* options.
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r--ext/mbstring/php_mbregex.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index ceda96398e..bcdff2c4c9 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -1682,8 +1682,8 @@ static void _php_mb_regex_set_options(OnigOptionType options, OnigSyntaxType *sy
Set or get the default options for mbregex functions */
PHP_FUNCTION(mb_regex_set_options)
{
- OnigOptionType opt;
- OnigSyntaxType *syntax;
+ OnigOptionType opt, prev_opt;
+ OnigSyntaxType *syntax, *prev_syntax;
char *string = NULL;
size_t string_len;
char buf[16];
@@ -1696,7 +1696,9 @@ PHP_FUNCTION(mb_regex_set_options)
opt = 0;
syntax = NULL;
_php_mb_regex_init_options(string, string_len, &opt, &syntax, NULL);
- _php_mb_regex_set_options(opt, syntax, NULL, NULL);
+ _php_mb_regex_set_options(opt, syntax, &prev_opt, &prev_syntax);
+ opt = prev_opt;
+ syntax = prev_syntax;
} else {
opt = MBREX(regex_default_options);
syntax = MBREX(regex_default_syntax);