Skip to content

Compiler: fix @settype + var_export(gettype()) arg misbind (#8974) - #16309

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-8974-settype-var-export-gettype-misbind
Jul 5, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-8974-settype-var-export-gettype-misbind

Conversation

@PurHur

@PurHur PurHur commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • After a standalone @settype() in an END_SILENCE block, var_export(gettype($x)) incorrectly used the @ suppress return slot (true) instead of the adjacent gettype() exec-return slot.
  • Adds errorSuppressEndBlockCallArgHasAdjacentNestedFuncCallProducer() guard in both prebind and ARG_SEND paths (lib/Compiler.php).
  • Regenerates docs/bootstrap-inventory.md for the new Compiler helper.

Root cause

php-src-strict @ forwarding (#15916) treated the first dead-temp arg of any post-suppress call as the suppressed inner result, even when an immediately preceding sibling gettype() call was the real producer for var_export().

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit --filter settype_backed_enum
vendor/bin/phpunit --filter ErrorSuppressInlineReturnSlotTest
php bin/vm.php test/repro/maintainer_gap_settype_var_export_gettype.php
php bin/vm.php test/compliance/cases/stdlib/settype_backed_enum_int.phpt
'

Output (2026-07-05):

OK (4 tests, 4 assertions)   # settype_backed_enum*
OK (8 tests, 28 assertions) # ErrorSuppressInlineReturnSlotTest
1
'integer'
1
'integer'
1
'integer'
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-link'
# bootstrap-selfhost-link: OK
php script/bootstrap-inventory.php --check
# OK 4036/4036

Closes #8974

Made with Cursor

After a standalone @settype() in an END_SILENCE block, var_export(gettype($x))
incorrectly forwarded the suppress return slot (bool true) instead of the
adjacent gettype() result — breaking settype_backed_enum_int compliance.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 06bd388 into master Jul 5, 2026
@PurHur
PurHur deleted the agent/issue-8974-settype-var-export-gettype-misbind branch July 5, 2026 05: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.

Stdlib: settype() on enum cases — must emit Warning before int coercion (ext/standard/type.c, php-src-strict)

1 participant