Category
Regression: · php-src-strict · SPL directory ctor open failure
Problem
When the directory path does not exist, Zend throws UnexpectedValueException with the concrete class name in the message. VM throws RuntimeException and always labels the message DirectoryIterator::__construct even for FilesystemIterator / RecursiveDirectoryIterator.
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('/no/such') |
UnexpectedValueException: DirectoryIterator::__construct(...): Failed to open directory: ... |
RuntimeException: DirectoryIterator::__construct(...): ... |
new FilesystemIterator('/no/such') |
UnexpectedValueException: FilesystemIterator::__construct(...): ... |
RuntimeException: DirectoryIterator::__construct(...): ... |
new RecursiveDirectoryIterator('/no/such') |
UnexpectedValueException: RecursiveDirectoryIterator::__construct(...): ... |
RuntimeException: DirectoryIterator::__construct(...): ... |
php-src reference
PHP implementation target
ext/spl/DirectoryIteratorBuiltin.php (DirectoryIteratorStorage::open) — throw UnexpectedValueException; use receiver class name in message
- Call sites already share
DirectoryIteratorStorage::open from Filesystem/Recursive ctors
- No new
runtime/*.c
Repro
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_spl_dir_missing_unexpected.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_spl_dir_missing_unexpected.php'
Done when
Category
Regression:· php-src-strict · SPL directory ctor open failureProblem
When the directory path does not exist, Zend throws
UnexpectedValueExceptionwith the concrete class name in the message. VM throwsRuntimeExceptionand always labels the messageDirectoryIterator::__constructeven forFilesystemIterator/RecursiveDirectoryIterator.Probed 2026-08-16 — host Zend PHP 8.2.32 vs
php bin/vm.php.new DirectoryIterator('/no/such')UnexpectedValueException: DirectoryIterator::__construct(...): Failed to open directory: ...RuntimeException: DirectoryIterator::__construct(...): ...new FilesystemIterator('/no/such')UnexpectedValueException: FilesystemIterator::__construct(...): ...RuntimeException: DirectoryIterator::__construct(...): ...new RecursiveDirectoryIterator('/no/such')UnexpectedValueException: RecursiveDirectoryIterator::__construct(...): ...RuntimeException: DirectoryIterator::__construct(...): ...php-src reference
ext/spl/spl_directory.c—spl_filesystem_object_construct/ open failure →UnexpectedValueExceptionPHP implementation target
ext/spl/DirectoryIteratorBuiltin.php(DirectoryIteratorStorage::open) — throwUnexpectedValueException; use receiver class name in messageDirectoryIteratorStorage::openfrom Filesystem/Recursive ctorsruntime/*.cRepro
Done when
UnexpectedValueExceptionwith Zend-shaped class-qualified message