Category
stdlib · php-src-strict
Problem
highlight_string(), highlight_file(), and show_source() reject non-string operands with LogicException in VM today. Zend/php-src raises catchable TypeError with must be of type string, E given when an enum case is passed — required for parity with other string builtins (#5524 family).
php-src reference
Repro
./script/docker-exec.sh -- php bin/vm.php test/repro-maintainer/issue_highlight_enum_typeerror.php
VM (wrong):
highlight_string: LogicException: highlight_string() expects string for argument 1 in this compiler build
highlight_file: LogicException: highlight_file() expects string for argument 1 in this compiler build
show_source: LogicException: highlight_file() expects string for argument 1 in this compiler build
Zend PHP 8.2+:
TypeError: highlight_string(): Argument #1 ($string) must be of type string, E given
Expected
All three builtins use VmString::coerceStringBuiltinArg() / EnumCaseSupport::isEnumCaseVariable() guard → TypeError message matching Zend naming ($string / $filename).
Implementation hints (PHP-in-PHP)
Verification
./script/docker-exec.sh -- php bin/vm.php test/repro-maintainer/issue_highlight_enum_typeerror.php
./script/ci-fast.sh --filter 'highlight_enum'
Related: bootstrap native tokenizer #4824, JIT phase 2 #4366 — this issue is operand typing only.
Category
stdlib· php-src-strictProblem
highlight_string(),highlight_file(), andshow_source()reject non-string operands withLogicExceptionin VM today. Zend/php-src raises catchableTypeErrorwithmust be of type string, E givenwhen an enum case is passed — required for parity with other string builtins (#5524 family).php-src reference
ext/standard/url.c—PHP_FUNCTION(highlight_string),PHP_FUNCTION(highlight_file)Z_PARAM_STR→TypeErroron object/enumRepro
VM (wrong):
Zend PHP 8.2+:
Expected
All three builtins use
VmString::coerceStringBuiltinArg()/EnumCaseSupport::isEnumCaseVariable()guard →TypeErrormessage matching Zend naming ($string/$filename).Implementation hints (PHP-in-PHP)
ext/standard/highlight_string.php,highlight_file.php,show_source.php— replaceLogicExceptiontype checks withVmString::coerceStringBuiltinArg()(same pattern aschr(),str_contains())test/compliance/cases/stdlib/highlight_enum_typeerror.phptVerification
./script/docker-exec.sh -- php bin/vm.php test/repro-maintainer/issue_highlight_enum_typeerror.php ./script/ci-fast.sh --filter 'highlight_enum'Related: bootstrap native tokenizer #4824, JIT phase 2 #4366 — this issue is operand typing only.