./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "echo class_exists(\"RecursiveRegexIterator\")?\"yes\":\"no\", PHP_EOL;"
php -r "echo class_exists(\"RecursiveRegexIterator\")?\"yes\":\"no\", PHP_EOL;"
'
<?php
$it = new ArrayIterator(['a1', 'b2', 'a3']);
$rx = new RecursiveRegexIterator($it, '/^a/', RecursiveRegexIterator::MATCH);
foreach ($rx as $v) { echo $v, "\n"; } // Zend: a1, a3
Category
stdlibProblem
RecursiveRegexIterator wraps an
Iteratorand yields only elements matching a PCRE pattern (used withRecursiveIteratorIteratorfor directory trees, config scanners, etc.). Not registered in this compiler (class_existsfalse).Distinct from #6639 (preg JIT lowering) and #6593 (base SPL iterators). Needs VM class +
accept()regex match using existingVmPreg/ host PCRE.php-src reference
ext/spl/spl_iterators.c—spl_ce_RecursiveRegexIterator,SPL_REGEX_*modesext/pcre/php_pcre.c— pattern matching foraccept()Repro
a1/a3linesScope (this repo)
ext/spl/RecursiveRegexIterator.php+ constants (MATCH,GET_MATCH, …)ext/spl/Module.php,ext/spl/BuiltinClasses.phppreg_matchparity layertest/compliance/cases/stdlib/recursive_regex_iterator.phptDone when
Error/ValueErrorper php-src mode flags.TypeError(php-src-strict), not silent backing coercion.Related