Skip to content

Regression: DirectoryIterator family null path ValueError generic Path — Zend Argument #1 ($directory) (ext/spl/spl_directory.c) #31512

Description

@PurHur

Category

Regression: · php-src-strict · SPL directory ctor empty/null path message

Problem

new DirectoryIterator(null) / FilesystemIterator(null) / RecursiveDirectoryIterator(null) on Zend soft-deprecate then throw ValueError citing Argument #1 ($directory) cannot be empty. VM soft-deprecates with wrong param name $filename and throws generic ValueError: Path cannot be empty.

Distinct from closed #31506 (missing directory → UnexpectedValueException class name / exception type).

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

Repro Zend 8.2+ VM (2026-08-16)
new DirectoryIterator(null) Deprecated $directory + ValueError: DirectoryIterator::__construct(): Argument #1 ($directory) cannot be empty Deprecated $filename + ValueError: Path cannot be empty
new FilesystemIterator(null) same shape with FilesystemIterator same generic Path cannot be empty
new RecursiveDirectoryIterator(null) same shape with RecursiveDirectoryIterator same generic Path cannot be empty

php-src reference

PHP implementation target

  • ext/spl/DirectoryIteratorBuiltin.php (shared open/ctor path) — Zend-shaped empty-path ValueError with concrete class + $directory
  • Fix deprecation param name $directory (not $filename)
  • No new runtime/*.c

Repro

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

Done when

  • All three ctors throw Zend-shaped ValueError citing Argument Php stdlib specs implementation #1 ($directory)
  • Null soft-deprecation names $directory
  • 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