Skip to content

Regression: LimitIterator::seek(null) TypeError — Zend E_DEPRECATED soft coerce (ext/spl/spl_iterators.c) #31676

Description

@PurHur

Category

Regression: · php-src-strict · LimitIterator::seek null offset

Problem

LimitIterator::seek(null) soft-coerces on Zend with E_DEPRECATED for parameter #1 ($offset) and seeks to offset 0. VM throws TypeError: Argument #1 ($offset) must be of type int, null given.

Distinct from closed #31621 (__construct null offset/limit) and #13963 (negative seek OutOfBounds).

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

Repro Zend 8.2+ VM (2026-08-16)
$l->seek(null) after rewind on [10,20,30] E_DEPRECATED#1 ($offset) + cur=10 key=0 TypeError$offset must be int

php-src reference

PHP implementation target

  • ext/spl/LimitIteratorBuiltin.php (or shared SPL int soft-null helper) — null $offset → 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_limititerator_seek_null.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_limititerator_seek_null.php'

Done when

  • Null $offset emits E_DEPRECATED citing parameter #1 ($offset) (no TypeError)
  • Seeks to 0 (current()===10 on the fixture)
  • 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