diff options
author | ju1ius <ju1ius@laposte.net> | 2016-07-30 13:55:46 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2016-08-05 13:22:10 +0200 |
commit | 03d03243fa09634895378923b53360e40a608c82 (patch) | |
tree | 605a822bfcba4d1e976bc30e777226c4aa3febe8 /ext/mbstring/php_mbregex.c | |
parent | 318d3b3a3ff2074bf80caf2a54b014eddac3eb1e (diff) | |
download | php-git-03d03243fa09634895378923b53360e40a608c82.tar.gz |
Fix #72711: `mb_ereg` does not clear the `$regs` parameter on failure
When `mb_ereg` failed to match, it didn't update the `$regs` argument.
Now it will always set it to the empty array.
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r-- | ext/mbstring/php_mbregex.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index db37bd3739..a9e464fa64 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -713,6 +713,11 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) RETURN_FALSE; } + if (array != NULL) { + zval_dtor(array); + array_init(array); + } + options = MBREX(regex_default_options); if (icase) { options |= ONIG_OPTION_IGNORECASE; @@ -751,8 +756,6 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) match_len = 1; str = string; if (array != NULL) { - zval_dtor(array); - array_init(array); match_len = regs->end[0] - regs->beg[0]; for (i = 0; i < regs->num_regs; i++) { |