Bug #72711 [Opn->Ver]: `mb_ereg` does not clear the `$regs` parameter on failure
| From: | cmb@php.net | Date: | Sat, 30 Jul 2016 23:13:11 +0000 |
| Subject: | Bug #72711 [Opn->Ver]: `mb_ereg` does not clear the `$regs` parameter on failure | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202743@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72711&edit=1
ID: 72711
Updated by: cmb@php.net
Reported by: ju1ius at laposte dot net
Summary:
mb_ereg does not clear the $regs parameter on
failure
-Status: Open
+Status: Verified
Type: Bug
Package: mbstring related
Operating System: Debian Sid
PHP Version: 5.6.24
Block user comment: N
Private report: N
New Comment:
See test cases of <https://github.com/php/php-src/pull/2046>.
Previous Comments:
------------------------------------------------------------------------
[2016-07-30 11:55:29] ju1ius at laposte dot net
Description:
------------
When mb_ereg does not match, it does not empty the $regs array parameters.
Test script:
---------------
<?php
var_dump(mb_ereg('(a)\1', 'aa', $m));
var_dump($m);
var_dump(mb_ereg('(a)\1', 'ab', $m));
var_dump($m);
var_dump(mb_ereg('(foo)\1', 'foofoo', $m));
var_dump($m);
Expected result:
----------------
int(2)
array(2) {
[0]=>
string(2) "aa"
[1]=>
string(1) "a"
}
bool(false)
array(0) {}
int(6)
array(2) {
[0]=>
string(6) "foofoo"
[1]=>
string(3) "foo"
}
Actual result:
--------------
int(2)
array(2) {
[0]=>
string(2) "aa"
[1]=>
string(1) "a"
}
bool(false)
array(2) {
[0]=>
string(2) "aa"
[1]=>
string(1) "a"
}
int(6)
array(2) {
[0]=>
string(6) "foofoo"
[1]=>
string(3) "foo"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72711&edit=1