Skip to content

Fix inline (int) enum cast call-arg slot wiring (#9479) - #9490

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-9479-enum-int-cast-warning
Jun 18, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-9479-enum-int-cast-warning

Conversation

@PurHur

@PurHur PurHur commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Treat Op\Expr\Cast as an inline call-arg producer so var_dump((int) E::A) wires the TYPE_CAST_INT result slot instead of the raw enum case.
  • Filter dead enum ClassConstFetch preludes that feed a cast via cfgExprUsesOperand.
  • Add maintainer repro, compliance guard (enum_int_cast_warning.phpt), and compile-time slot unit test.

Closes #9479

php-src reference

  • Zend/zend_operators.c — cast_object / int cast on enum cases (E_WARNING + backing int)
  • Zend/zend_enum.c — enum object cast rules

Verification

./script/docker-exec.sh php bin/vm.php test/repro/maintainer_gap_enum_int_cast_warning.php
# 1
# 'Object of class E could not be converted to int'

./script/docker-exec.sh php vendor/bin/phpunit --filter 'enum_int_cast_warning|InlineCallArgProducerSlotTest::testVarDumpIntCastEnumCaseUsesCastProducerSlot'
# OK (2 tests, 3 assertions)

Also verified related guard still green:

./script/docker-exec.sh php vendor/bin/phpunit --filter 'int_cast_backed_enum'
# OK (1 test, 1 assertion)

Made with Cursor

Treat Cast as an inline call-arg producer so var_dump((int) E::A) receives the TYPE_CAST_INT result with Zend E_WARNING parity; add repro and compliance 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: (int) cast on enum case must emit E_WARNING like Zend (Zend/zend_enum.c)

1 participant