Skip to content

Language: continue/break 0 is Zend positive-integer compile fatal (#32155) - #32167

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-32155-continue-zero
Aug 18, 2026
Merged

Language: continue/break 0 is Zend positive-integer compile fatal (#32155)#32167
PurHur merged 2 commits into
masterfrom
agent/issue-32155-continue-zero

Conversation

@PurHur

@PurHur PurHur commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • continue 0 / break 0 now compile-abort with php-src's 'continue' operator accepts only positive integers (same for break), instead of leaking php-parser Too high of a count for Stmt_Continue.
  • PHP SSOT in lib/Ast/BreakContinueOperandCompileCheck.php (AST visitor before php-cfg LoopResolver); JIT stdout stays empty — fatal is on stderr as Zend PHP Fatal error.
  • Vendor LoopResolver distinguishes non-positive vs too-deep so a missed visitor still cannot emit Stmt_Continue.

php-src: Zend/zend_compile.c (zend_compile_break_continue()).
PHP: lib/Ast/BreakContinueOperandCompileCheck.php, lib/Runtime.php.
C runtime lines removed: none.

Closes #32155

Test plan

  • Issue repro VM + JIT (stderr/stdout split)
  • Dedicated PHPUnit ContinueZero32155VMTest / JITTest
  • Unit BreakContinueOperandCompileCheckTest + GotoStatementTest

Verification

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_continue_zero.php 2>&1; echo EXIT:$?'
PHP Fatal error:  'continue' operator accepts only positive integers in /compiler/test/repro/maintainer_gap_continue_zero.php on line 3
EXIT:255
./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_continue_zero.php > /tmp/c0-out.txt 2> /tmp/c0-err.txt; echo EXIT:$?; echo "---stdout---"; cat /tmp/c0-out.txt; echo "---stderr---"; cat /tmp/c0-err.txt'
EXIT:255
---stdout---
---stderr---
PHP Fatal error:  'continue' operator accepts only positive integers in /compiler/test/repro/maintainer_gap_continue_zero.php on line 3
./script/phpunit.sh --filter 'ContinueZero32155|BreakContinueOperandCompileCheck|GotoStatementTest'
OK (16 tests, 35 assertions)
./script/docker-exec.sh -- bash -lc 'php script/bootstrap-inventory.php --check'
OK 7579/7579

Not covered: full VMTest/JITTest suites; AOT phpc build of this repro; ci-fast.sh; check-selfhost-spine-coverage-sync.php is red on this tree for 6 pre-existing inventory files not in spine (JitLdapResult.php, StreamIncludeOpen*, …) — our new unit is required from the spine.

Made with Cursor

PurHur and others added 2 commits August 18, 2026 11:37
…2155)

php-cfg LoopResolver leaked Stmt_Continue for continue 0; reject non-positive
depth in PHP before CFG rewrite so VM/JIT abort with php-src's message on stderr.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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: continue 0 leaks php-parser Stmt_Continue — Zend "accepts only positive integers" (Zend/zend_compile.c)

1 participant