Skip to content

Language: throw expressions (PHP 8.0) — ?:, ??, && lowering (#3802) - #3821

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-3802-throw-expressions
May 30, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-3802-throw-expressions

Conversation

@PurHur

@PurHur PurHur commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix compiler lowering for PHP 8.0 throw expressions in ternary (?:), null-coalesce (??), and short-circuit (&&) contexts
  • Skip duplicate New_ before Throw_, allocate throw objects on a fresh slot (avoid ?: merge phi collision), and drop unreachable CFG ops after throw
  • Route ?? throw RHS through compileThrowExpression() with entry-block New_ lookup
  • Add test/compliance/cases/language/throw_expression.phpt and capability-syntax entry

php-src reference

  • Zend/zend_compile.czend_compile_throw() from expression compile paths
  • Zend/zend_language_parser.yT_THROW expr in expression grammar

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter throw_expression'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./script/ci-fast.sh --filter throw_expression'

Existing vendor patches (php-cfg-throw-expr.patch, php-types-throw-expr.patch) provide parse/type-reconstruction support; no new vendor edits in this PR.

Notes

Closes #3802

Made with Cursor

Fix duplicate New lowering before Throw, allocate throw objects outside
?: merge phi slots, and skip unreachable CFG ops after throw-expr. Adds
compliance coverage and capability-syntax entry for PHP 8.0 throw expressions.

php-src: Zend/zend_compile.c zend_compile_throw(), zend_language_parser.y
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 4b41605 into master May 30, 2026
@PurHur
PurHur deleted the agent/issue-3802-throw-expressions branch May 30, 2026 13:56
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: throw expressions (PHP 8.0) — parse and lowering in expression context

1 participant