Category
Regression · php-src-strict · stdlib (SPL iterators)
Problem
When a CachingIterator was constructed with CachingIterator::CALL_TOSTRING (or the flag is set), php-src refuses to clear that flag via setFlags(): it throws InvalidArgumentException with message Unsetting flag CALL_TO_STRING is not possible. On VM (2026-07-28), setFlags(CachingIterator::FULL_CACHE) and setFlags(0) succeed and drop CALL_TOSTRING.
| Repro |
Zend 8.2 |
VM (2026-07-28) |
construct with CALL_TOSTRING, then setFlags(FULL_CACHE) |
InvalidArgumentException |
flags become 256 |
then setFlags(0) |
same exception |
flags become 0 |
php-src reference
PHP implementation target
ext/spl/ CachingIterator setFlags implementation (PHP) — reject clearing CALL_TOSTRING like php-src
- Keep construct/getFlags parity; no new C runtime logic
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_cachingiterator_setflags_call_tostring.php'
<?php
$it = new CachingIterator(new ArrayIterator([1]), CachingIterator::CALL_TOSTRING);
$it->setFlags(CachingIterator::FULL_CACHE); // Zend: InvalidArgumentException
Done when
Category
Regression· php-src-strict · stdlib (SPL iterators)Problem
When a
CachingIteratorwas constructed withCachingIterator::CALL_TOSTRING(or the flag is set), php-src refuses to clear that flag viasetFlags(): it throwsInvalidArgumentExceptionwith messageUnsetting flag CALL_TO_STRING is not possible. On VM (2026-07-28),setFlags(CachingIterator::FULL_CACHE)andsetFlags(0)succeed and dropCALL_TOSTRING.CALL_TOSTRING, thensetFlags(FULL_CACHE)InvalidArgumentExceptionsetFlags(0)php-src reference
ext/spl/spl_iterators.c—CachingIterator::setFlags/CIT_CALL_TOSTRINGguard ("Unsetting flag CALL_TO_STRING is not possible")PHP implementation target
ext/spl/CachingIteratorsetFlagsimplementation (PHP) — reject clearingCALL_TOSTRINGlike php-srcRepro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_cachingiterator_setflags_call_tostring.php'Done when
setFlagsthat would clearCALL_TOSTRINGthrowsInvalidArgumentExceptionwith Zend messagetest/repro/guard