Skip to content

Language: include() syntax errors throw catchable ParseError (#32154) - #32162

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-include-parse-32154
Aug 18, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-include-parse-32154

Conversation

@PurHur

@PurHur PurHur commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • include/require of a syntax-error file now throws a catchable ParseError into the caller (try/catch (Throwable)), matching php-src ZEND_INCLUDE_OR_EVAL / zend_compile_file.
  • VM and JIT both go through VmInclude PHP SSOT. parseAndCompileFile(..., forIncludeTarget: true) no longer dumps parseAndCompile failure / PhpParser\ / bundle_snippet on stderr.
  • No new runtime/*.c logic (C runtime lines removed: none; this is a PHP-only path).

php-src: Zend/zend_execute.c (ZEND_INCLUDE_OR_EVAL), Zend/zend_compile.c (zend_compile_file).
PHP: lib/VM/VmInclude.php, lib/VM.php, lib/Runtime.php, lib/JIT/IncludeHelper.php.

Closes #32154

Test plan

  • Issue repro VM + JIT
  • Dedicated PHPUnit IncludeParseError32154VMTest / JITTest
  • VmIncludeTest + IncludeHelperShrinkTest + IncludeInheritsThis*

Verification

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_include_parse.php 2>&1; echo EXIT:$?'
ParseError:syntax error, unexpected T_LNUMBER, expecting ';'
EXIT:0
./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_include_parse.php 2>&1; echo EXIT:$?'
ParseError:syntax error, unexpected T_LNUMBER, expecting ';'
EXIT:0

(php-parser token text T_LNUMBER is the equivalent of Zend integer "2".)

./script/phpunit.sh --filter 'IncludeParseError32154|IncludeHelperShrinkTest|VmIncludeTest|IncludeInheritsThis'
OK (13 tests, 39 assertions)

Not covered: full VMTest/JITTest suites; AOT phpc build of this repro; ci-fast.sh.

Made with Cursor

ZEND_INCLUDE_OR_EVAL compile failures are ParseError in the caller, not a
process-fatal parseAndCompile dump. Route VM and JIT include targets through
VmInclude PHP SSOT with no new C runtime logic.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit bb7147c into master Aug 18, 2026
1 check failed
@PurHur
PurHur deleted the agent/runtime-php-include-parse-32154 branch August 18, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: include() of syntax-error file is process fatal — Zend catchable ParseError (Zend/zend_execute.c)

1 participant