Skip to content

Language: bare throw; rethrow — repro + compliance guard (#17691) - #17705

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-17691-bare-throw-rethrow
Jul 10, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-17691-bare-throw-rethrow

Conversation

@PurHur

@PurHur PurHur commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add test/repro/maintainer_gap_bare_throw_rethrow.php with // php-compiler-language-profile=8.4 so the issue repro runs without CLI env.
  • Add test/compliance/cases/language/bare_throw_rethrow.phpt guarding nested catch rethrow semantics (php-src-strict on 8.4 forward profile).
  • Bare rethrow lowering (SourceBareThrowRewriter → TYPE_RETHROW) was already implemented; this closes the missing repro/compliance gap tracked in Language: bare throw; rethrow — parse error in catch block (Zend/zend_compile.c) #17691.

Closes #17691

php-src reference

  • Zend/zend_compile.c — bare throw; rethrow in catch scope (PHP 8.4 forward profile)

PHP implementation (existing)

  • lib/SourceBareThrowRewriter.php — parse lowering
  • lib/BareThrowSyntaxRejector.php — reference-profile gate
  • lib/Compiler.php / lib/VM.php / lib/JIT.php — TYPE_RETHROW opcode

Verification

# Issue repro (no CLI profile — source pragma applies 8.4)
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_bare_throw_rethrow.php'
# inner

# JIT same script
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/jit.php test/repro/maintainer_gap_bare_throw_rethrow.php'
# inner

# Compliance phpt
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php -d memory_limit=512M vendor/bin/phpunit test/compliance/VMTest.php --filter bare_throw_rethrow'
# OK (1 test, 1 assertion)

# Unit slice
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php -d memory_limit=512M vendor/bin/phpunit test/unit/TryCatchComplianceTest.php --filter testBareThrow'
# OK (2 tests, 2 assertions)

Made with Cursor

…#17691).

Bare rethrow is already implemented on the 8.4 forward profile via SourceBareThrowRewriter
and TYPE_RETHROW; this wires the issue repro path and a php-src-strict phpt guard.

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: bare throw; rethrow — parse error in catch block (Zend/zend_compile.c)

1 participant