Skip to content

Compiler: fix stream_context_create([]) after @mkdir misbind (#16205) - #16220

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-16205-stream-context-empty-array
Jul 4, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-16205-stream-context-empty-array

Conversation

@PurHur

@PurHur PurHur commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix compiler lowering where hoisted [] in a post-@ END block was aliased to the suppressed call's return slot (bool from @mkdir), causing stream_context_create([]) to receive bool instead of array.
  • Mirrors the existing null-literal guard from Regression: get_cfg_var('display_errors') — returns true not empty string (ext/standard/ini.c) #15916; adds errorSuppressEndBlockCallArgHasTrailingHoistedArrayProducer() with positional fallback like scalar hoists.
  • PHP implementation in lib/Compiler.php (no C runtime changes).

php-src reference

  • ext/standard/streams.c — php_stream_context_from_options() accepts empty options array

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php test/repro/maintainer_gap_stream_context_create_after_mkdir.php && php bin/vm.php test/repro/maintainer_gap_stream_context_create_after_mkdir.php'
# ok / ok

vendor/bin/phpunit --filter ErrorSuppressInlineReturnSlotTest
# OK (5 tests, 17 assertions)

vendor/bin/phpunit --filter stream_context_create_empty_after_mkdir
# OK (2 tests, 2 assertions) — VM + JIT compliance

Closes #16205

Made with Cursor

Hoisted empty-array literals in post-@ END blocks were aliased to the
suppressed call's return slot (same class of bug as null literals in #15916).
Skip suppress-slot binding when a trailing Array_ feeds the dead-temp arg.

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.

Regression: stream_context_create([]) after @mkdir — empty literal not typed array (ext/standard/streams.c)

1 participant