Skip to content

Regression: RegexIterator::setMode ValueError cites __construct arg #3 — Zend setMode arg #1 (ext/spl/spl_iterators.c) #31573

Description

@PurHur

Category

Regression: · php-src-strict · RegexIterator::setMode invalid mode ValueError citation

Problem

RegexIterator::setMode(99) on Zend throws ValueError: RegexIterator::setMode(): Argument #1 ($mode) must be RegexIterator::MATCH, …. VM throws the same constraint text but attributes it to RegexIterator::__construct(): Argument #3 ($mode) (constructor wording reused for the setter).

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

Repro Zend 8.2+ VM (2026-08-16)
(new RegexIterator(new ArrayIterator(['a']), '/a/'))->setMode(99) ValueError: RegexIterator::setMode(): Argument #1 ($mode) must be … ValueError: RegexIterator::__construct(): Argument #3 ($mode) must be …

php-src reference

PHP implementation target

Repro

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

Done when

  • setMode(99) ValueError message matches Zend (RegexIterator::setMode(): Argument #1 ($mode) …)
  • 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