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
Category
Regression:· php-src-strict · SPL directory ctor empty/null path messageProblem
new DirectoryIterator(null)/FilesystemIterator(null)/RecursiveDirectoryIterator(null)on Zend soft-deprecate then throwValueErrorciting Argument #1 ($directory) cannot be empty. VM soft-deprecates with wrong param name$filenameand throws genericValueError: Path cannot be empty.Distinct from closed #31506 (missing directory →
UnexpectedValueExceptionclass name / exception type).Probed 2026-08-16 — host Zend PHP 8.2.32 vs
php bin/vm.php.new DirectoryIterator(null)$directory+ValueError: DirectoryIterator::__construct(): Argument #1 ($directory) cannot be empty$filename+ValueError: Path cannot be emptynew FilesystemIterator(null)FilesystemIteratorPath cannot be emptynew RecursiveDirectoryIterator(null)RecursiveDirectoryIteratorPath cannot be emptyphp-src reference
ext/spl/spl_directory.c— empty directory check →zend_argument_value_error/Argument #1 ($directory) cannot be emptyext/spl/spl_directory.stub.php— param$directoryPHP implementation target
ext/spl/DirectoryIteratorBuiltin.php(shared open/ctor path) — Zend-shaped empty-pathValueErrorwith concrete class +$directory$directory(not$filename)runtime/*.cRepro
Done when
ValueErrorciting Argument Php stdlib specs implementation #1 ($directory)$directory