|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-11-21 22:48 UTC] cmbecker69 at gmx dot de
[2014-12-28 20:42 UTC] kalle@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: kalle
[2014-12-28 20:42 UTC] kalle@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 23:00:01 2025 UTC |
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 ) ) )