[php-src] Issue #7730: RecursiveRegexIterator
| From: | noreply@php.net | Date: | Tue, 07 Dec 2021 13:16:09 +0000 |
| Subject: | [php-src] Issue #7730: RecursiveRegexIterator | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238259@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7730
Comment Author: WinterSilence
@iluuu1994
> I suggest using this approach. RecursiveRegexIterator probably works as expected, although its
> usefulness is questionable. There are only 21 usages of this class on GitHub.
This class is need only in cases like this, but it's no matter.
I repeat again: I don't find "howto", I report about incorrect behavior. It's
doesn't work when we pass
RecursiveIteratorIterator::LEAVES_ONLY too:
~~~php
$regex = new RecursiveRegexIterator(
new RecursiveDirectoryIterator(__DIR__, RecursiveDirectoryIterator::UNIX_PATHS),
'/((?:[A-Z][a-zA-Z\d]+\/)*[A-Z][a-zA-Z\d]+)\.php$/',
RecursiveRegexIterator::GET_MATCH
);
$iterator = new RecursiveIteratorIterator($regex, RecursiveIteratorIterator::LEAVES_ONLY);
var_dump(iterator_to_array($iterator));
~~~