Category
Regression: · php-src-strict · CachingIterator mutually exclusive TOSTRING flags
Problem
Zend rejects combinations of more than one of CALL_TOSTRING / TOSTRING_USE_KEY / TOSTRING_USE_CURRENT / TOSTRING_USE_INNER with ValueError on both __construct and setFlags. VM accepts the multi-bit mask silently (construct + setFlags succeed).
Sibling history: #24252 (setFlags clearing CALL_TOSTRING), #22336 (default/null flags) — neither covers the exclusive-OR ValueError gate.
Probed 2026-08-16 — host Zend PHP 8.2.32 vs php bin/vm.php.
| Repro |
Zend 8.2+ |
VM (2026-08-16) |
new CachingIterator($it, CALL_TOSTRING|TOSTRING_USE_KEY) |
ValueError: CachingIterator::__construct(): Argument #2 ($flags) must contain only one of … |
construct succeeds |
$c->setFlags(CALL_TOSTRING|TOSTRING_USE_KEY) |
ValueError: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of … |
setFlags succeeds |
php-src reference
PHP implementation target
ext/spl/CachingIteratorBuiltin.php — shared flag validator used by construct + setFlags (and RecursiveCachingIterator if it shares the path)
- PHP-in-PHP; no new
runtime/*.c
Repro
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_cachingiterator_multi_tostring_flags.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_cachingiterator_multi_tostring_flags.php'
Done when
Category
Regression:· php-src-strict · CachingIterator mutually exclusive TOSTRING flagsProblem
Zend rejects combinations of more than one of
CALL_TOSTRING/TOSTRING_USE_KEY/TOSTRING_USE_CURRENT/TOSTRING_USE_INNERwithValueErroron both__constructandsetFlags. VM accepts the multi-bit mask silently (construct + setFlags succeed).Sibling history: #24252 (setFlags clearing CALL_TOSTRING), #22336 (default/null flags) — neither covers the exclusive-OR ValueError gate.
Probed 2026-08-16 — host Zend PHP 8.2.32 vs
php bin/vm.php.new CachingIterator($it, CALL_TOSTRING|TOSTRING_USE_KEY)ValueError: CachingIterator::__construct(): Argument #2 ($flags) must contain only one of …$c->setFlags(CALL_TOSTRING|TOSTRING_USE_KEY)ValueError: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of …php-src reference
ext/spl/spl_iterators.c—spl_caching_it_set_flags/ construct flag validation (exactly one TOSTRING bit)ext/spl/spl_iterators.stub.php—CachingIterator::__construct/setFlagsPHP implementation target
ext/spl/CachingIteratorBuiltin.php— shared flag validator used by construct +setFlags(and RecursiveCachingIterator if it shares the path)runtime/*.cRepro
Done when
setFlagswith two TOSTRING bits throw Zend-shapedValueErrormessagesFULL_CACHEcombinations still match Zend