Skip to content

Regression: CachingIterator::setFlags(null) TypeError — Zend E_DEPRECATED soft coerce (ext/spl/spl_iterators.c) #31694

Description

@PurHur

Category

Regression: · php-src-strict · CachingIterator::setFlags null flags

Problem

CachingIterator::setFlags(null) soft-coerces on Zend with E_DEPRECATED for parameter #1 ($flags) and stores flags=0. VM throws TypeError: Argument #1 ($flags) must be of type int, null given.

Distinct from open #31679 (__construct null $flags missing deprecate) and closed #24252 / #31551 (flag bit ValueError / CALL_TOSTRING).

Probed 2026-08-17 — host Zend PHP 8.2+ vs php bin/vm.php.

Repro Zend 8.2+ VM (2026-08-17)
$c->setFlags(null) after FULL_CACHE construct E_DEPRECATED#1 ($flags) + flags=0 TypeError$flags must be int

php-src reference

PHP implementation target

  • ext/spl/CachingIteratorBuiltin.php — null $flags → Zend E_DEPRECATED then coerce to 0 (do not TypeError)
  • No new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_cachingiterator_setflags_null.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_cachingiterator_setflags_null.php'

Done when

  • Null $flags emits E_DEPRECATED citing parameter #1 ($flags) (no TypeError)
  • getFlags() is 0 after the call
  • Targeted compliance/PHPUnit guard
  • php-src-strict; no php-compiler-strict shortcut

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions