php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72711 `mb_ereg` does not clear the `$regs` parameter on failure
Submitted: 2016-07-30 11:55 UTC Modified: 2016-07-30 23:13 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: ju1ius at laposte dot net Assigned:
Status: Closed Package: mbstring related
PHP Version: 5.6.24 OS: Debian Sid
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ju1ius at laposte dot net
New email:
PHP Version: OS:

 

 [2016-07-30 11:55 UTC] 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"
}

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-30 23:13 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2016-07-30 23:13 UTC] cmb@php.net
See test cases of <https://github.com/php/php-src/pull/2046>.
 [2016-08-05 11:31 UTC] cmb@php.net
Automatic comment on behalf of ju1ius@laposte.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=03d03243fa09634895378923b53360e40a608c82
Log: Fix #72711: `mb_ereg` does not clear the `$regs` parameter on failure
 [2016-08-05 11:31 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-08-05 11:46 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339793
Log: Update docs wrt. to bugfix #72711
 [2016-10-17 10:10 UTC] bwoebi@php.net
Automatic comment on behalf of ju1ius@laposte.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=03d03243fa09634895378923b53360e40a608c82
Log: Fix #72711: `mb_ereg` does not clear the `$regs` parameter on failure
 [2020-02-07 06:06 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=a70d5fcf20a5776c5d8cba6481d2ce96eaa78d43
Log: Update docs wrt. to bugfix #72711
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC