Category
stdlib · php-src-strict · regression
Problem
Path and stat builtins with string-typed path operands must throw TypeError when passed an enum case. Issue #5944 was closed with compliance coverage, but VM still accepts enum operands silently by coercing the backing string.
Verified 2026-06-16: Zend PHP 8.2 vs php bin/vm.php.
php-src reference
Repro
test/repro/maintainer_gap_path_stat_enum.php
php test/repro/maintainer_gap_path_stat_enum.php
php bin/vm.php test/repro/maintainer_gap_path_stat_enum.php
| Function |
Zend |
VM (wrong) |
dirname(Ep::A) |
TypeError |
returns '/tmp' (coerced) |
basename(Ep::A) |
TypeError |
returns 'x' |
file_exists(Ep::A) |
TypeError |
returns false |
is_readable(Ep::A) |
TypeError |
returns false |
Existing compliance (expectations not met on VM): test/compliance/cases/stdlib/pathinfo_enum_type_error.phpt
Scope (PHP-in-PHP)
| Path |
Work |
ext/standard/dirname.php, basename.php, pathinfo.php, realpath.php |
VmString::coerceStringBuiltinArg / TypeError before coercion |
ext/standard/file_exists.php, is_file.php, is_dir.php, is_readable.php |
Same path-operand guard |
lib/JIT/Builtin/Standard/* |
JIT parity |
| Tests |
Re-enable/extend pathinfo_enum_type_error.phpt; add maintainer repro to CI filter |
Done when
Related
#5944 (closed, regressed) · #8781 glob enum · #1492
Category
stdlib· php-src-strict · regressionProblem
Path and stat builtins with string-typed path operands must throw
TypeErrorwhen passed an enum case. Issue #5944 was closed with compliance coverage, but VM still accepts enum operands silently by coercing the backing string.Verified 2026-06-16: Zend PHP 8.2 vs
php bin/vm.php.php-src reference
ext/standard/filestat.c—file_exists,is_file,is_dir,is_readableext/standard/dir.c—dirname,basenameext/standard/basic_functions.c—pathinfo,realpathRepro
test/repro/maintainer_gap_path_stat_enum.phpdirname(Ep::A)TypeError'/tmp'(coerced)basename(Ep::A)TypeError'x'file_exists(Ep::A)TypeErrorfalseis_readable(Ep::A)TypeErrorfalseExisting compliance (expectations not met on VM):
test/compliance/cases/stdlib/pathinfo_enum_type_error.phptScope (PHP-in-PHP)
ext/standard/dirname.php,basename.php,pathinfo.php,realpath.phpVmString::coerceStringBuiltinArg/ TypeError before coercionext/standard/file_exists.php,is_file.php,is_dir.php,is_readable.phplib/JIT/Builtin/Standard/*pathinfo_enum_type_error.phpt; add maintainer repro to CI filterDone when
TypeErroras Zend for backed enum operandstest/compliance/cases/stdlib/pathinfo_enum_type_error.phptgreen on VMRelated
#5944 (closed, regressed) · #8781 glob enum · #1492