You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP supports __halt_compiler() to terminate compilation and leave trailing bytes in the source file (used by PHAR stubs and some codegen tools). php-parser already parses Stmt\HaltCompiler, but this compiler has no lowering — function_exists('__halt_compiler') is false and scripts using the construct fail at compile time.
Verified May 2026: trailing bytes after halt are parsed as PHP, causing syntax errors on garbage data.
Category
language/compilerProblem
PHP supports
__halt_compiler()to terminate compilation and leave trailing bytes in the source file (used by PHAR stubs and some codegen tools). php-parser already parsesStmt\HaltCompiler, but this compiler has no lowering —function_exists('__halt_compiler')is false and scripts using the construct fail at compile time.Verified May 2026: trailing bytes after halt are parsed as PHP, causing syntax errors on garbage data.
php-src reference
Zend/zend_compile.c—zend_compile_halt_compiler()Zend/zend_language_scanner.l—T_HALT_COMPILERext/phar/phar.c— PHAR stub generation relies on halt compiler semanticsRepro (failure today)
echo "before"; ignores trailing bytesScope (this repo)
vendor/ircmaxell/php-cfg/ patches — lowerStmt\HaltCompilerto compile-stop markerlib/Compiler.php— ignore/reject statements after halt; optionally storeremainingbytesext/standard/— register__halt_compiler()builtin (runtime call may fatal per Zend)lib/Done when
beforeunderphp bin/vm.php; no parse error on trailingTRAILING_BYTES…function_exists('__halt_compiler')returns true__halt_compiler()behavior matches Zend (compile error or fatal as appropriate)test/compliance/cases/language/halt_compiler.phptVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php vendor/bin/phpunit --filter halt_compiler'