Category
language · php-src-strict · include · ParseError
Problem
include of a file with a syntax error is a catchable ParseError in php-src: user try/catch (Throwable) runs and execution continues. This compiler aborts the process with parseAndCompile failure, leaks PhpParser\Error / bundle_snippet internals, and never enters the catch block.
| Repro |
Zend 8.2+ |
VM/JIT (2026-08-18 @ 8d228396dc) |
try { include 'bad.php'; echo "after"; } catch (Throwable $e) { echo get_class($e), ':', $e->getMessage(); } where bad.php is <?php echo 1 2; |
stdout ParseError:syntax error, unexpected integer "2", expecting "," or ";" (rc=0) |
process fatal parseAndCompile failure + PhpParser dump (rc=255); catch never runs |
Silent-wrong vs Zend: callers cannot recover from a bad include the way php-src allows.
php-src reference
PHP implementation target
lib/ include/require compile-and-run — convert php-parser syntax errors into a catchable ParseError (Zend message text) instead of aborting parseAndCompile
- Do not leak
PhpParser\Error or bundle_snippet to user stderr
- JIT/AOT must match VM; no new
runtime/*.c logic
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_include_parse.php 2>&1 | head -8'
./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_include_parse.php 2>&1 | head -8'
Done when
Category
language· php-src-strict · include · ParseErrorProblem
includeof a file with a syntax error is a catchableParseErrorin php-src: usertry/catch (Throwable)runs and execution continues. This compiler aborts the process withparseAndCompile failure, leaksPhpParser\Error/bundle_snippetinternals, and never enters the catch block.8d228396dc)try { include 'bad.php'; echo "after"; } catch (Throwable $e) { echo get_class($e), ':', $e->getMessage(); }wherebad.phpis<?php echo 1 2;ParseError:syntax error, unexpected integer "2", expecting "," or ";"(rc=0)parseAndCompile failure+ PhpParser dump (rc=255); catch never runsSilent-wrong vs Zend: callers cannot recover from a bad include the way php-src allows.
php-src reference
Zend/zend_execute.c—ZEND_INCLUDE_OR_EVALinclude/requireZend/zend_compile.c— compile of included source; parse failures becomeParseErrorthrown into the callerPHP implementation target
lib/include/require compile-and-run — convert php-parser syntax errors into a catchableParseError(Zend message text) instead of abortingparseAndCompilePhpParser\Errororbundle_snippetto user stderrruntime/*.clogicRepro
Done when
try { include …syntax error… } catch (Throwable $e)on VM and JIT printsParseError:plus Zend substringunexpected/ integer2(or equivalent php-src 8.2 token text) and rc=0parseAndCompile failure/PhpParser\/bundle_snippeton stderr.phptguard undertest/compliance/cases/language/include_parse_error*.phpt