Skip to content

Regression: RecursiveIteratorIterator(null $mode) silent — Zend E_DEPRECATED parameter #2 (ext/spl/spl_iterators.c) #31622

Description

@PurHur

Category

Regression: · php-src-strict · RecursiveIteratorIterator soft-null mode

Problem

new RecursiveIteratorIterator(new RecursiveArrayIterator([1,[2]]), null) on Zend emits E_DEPRECATED: RecursiveIteratorIterator::__construct(): Passing null to parameter #2 ($mode) of type int is deprecated, then coerces and iterates ([2] leaves-only default). VM produces the same iteration result but omits the deprecation.

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

Repro Zend 8.2+ VM (2026-08-16)
new RecursiveIteratorIterator(new RecursiveArrayIterator([1,[2]]), null) E_DEPRECATED then [2] [2] only (no deprecation)

php-src reference

PHP implementation target

  • ext/spl/ RII ctor — shared soft-null int deprecate/coerce (same family as LimitIterator null offset); no new runtime/*.c

Repro

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

Done when

  • null $mode emits Zend E_DEPRECATED citing parameter Php stdlib specs implementation #2 ($mode)
  • Iteration result unchanged ([2] for this fixture)
  • strict_types=1 TypeError preserved
  • 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