Bug #66703 [Opn->Csd]: RegexIterator's ALL_MATCH does not filter
Edit report at https://bugs.php.net/bug.php?id=66703&edit=1
ID: 66703
Updated by: kalle@php.net
Reported by: jthijssen+php at noxlogic dot nl
Summary: RegexIterator's ALL_MATCH does not filter
-Status: Open
+Status: Closed
Type: Bug
Package: SPL related
PHP Version: master-Git-2014-02-12 (Git)
-Assigned To:
+Assigned To: kalle
Block user comment: N
Private report: N
New Comment:
Marking this as fixed as per comment by cmbecker69 at gmx dot de, I'm not able to reproduce it
either on my local php-master (7-dev) build.
Please re-open if the issue continues to exists.
Previous Comments:
------------------------------------------------------------------------
[2014-11-21 22:48:52] cmbecker69 at gmx dot de
Apparently, this issue has recently been fixed for PHP 5.5.19 and
5.6.3, see <http://3v4l.org/SkLsJ>. That might have been a
side
effect of fixing <https://bugs.php.net/bug.php?id=68128>.
BTW: the expected and actual results given above are mixed up.
------------------------------------------------------------------------
[2014-02-12 20:49:06] jthijssen+php at noxlogic dot nl
Description:
------------
When filtering with the RegexIterator and using the ALL_MATCH mode, every element is returned, even
if it does not have any matches. This functionality differs from the GET_MATCH, which does filter
out empty/non-matching elements
Test script:
---------------
$it = new \ArrayIterator(array("tmp", "foo", "bar",
"bazbar"));
$it = new \RegexIterator($it, "/ba(.)/", \RegexIterator::ALL_MATCHES);
print_r(iterator_to_array($it));
Expected result:
----------------
Array
(
[0] => Array
(
[0] => Array
(
)
[1] => Array
(
)
)
[1] => Array
(
[0] => Array
(
)
[1] => Array
(
)
)
[2] => Array
(
[0] => Array
(
[0] => bar
)
[1] => Array
(
[0] => r
)
)
[3] => Array
(
[0] => Array
(
[0] => baz
[1] => bar
)
[1] => Array
(
[0] => z
[1] => r
)
)
)
Actual result:
--------------
Array
(
[2] => Array
(
[0] => Array
(
[0] => bar
)
[1] => Array
(
[0] => r
)
)
[3] => Array
(
[0] => Array
(
[0] => baz
[1] => bar
)
[1] => Array
(
[0] => z
[1] => r
)
)
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66703&edit=1
Thread (3 messages)