Skip to content

Compiler: file_get_contents data:// inline concat + offset/length (#18613)#18622

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-18613-file-get-contents-data-offset
Jul 13, 2026
Merged

Compiler: file_get_contents data:// inline concat + offset/length (#18613)#18622
PurHur merged 1 commit into
masterfrom
agent/issue-18613-file-get-contents-data-offset

Conversation

@PurHur

@PurHur PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix compiler inline call-arg producer wiring when file_get_contents() takes an inline string concat as arg 0 plus hoisted false/null context args and embedded offset/length literals.
  • Root cause: callArgsAreDistinctInlineTemporaries() rejected calls with trailing embedded literal args, so the Concat prelude was never collected and arg 0 bound to a hoisted false ConstFetch → empty path ValueError.
  • PHP implementation in lib/Compiler.php (hoistedCallArgsAreDistinctInlineTemporaries); no C runtime change.

php-src reference

  • ext/standard/file.cphp_file_get_contents_ex data URI slice with offset/maxlen
  • Zend behavior: file_get_contents('data://text/plain,'.$payload, false, null, 3, 4)3456

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/maintainer_file_get_contents_data_offset.php
php bin/vm.php test/repro/maintainer_file_get_contents_data_offset.php
'
# Zend: 3456
# VM:   3456

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit --filter file_get_contents_data_offset
vendor/bin/phpunit --filter testFileGetContentsInlineConcatFalseNullOffsetLengthUsesProducerSlots
'
# OK (compliance VM+JIT + unit slot guard)

Closes #18613

Made with Cursor

Hoisted Concat + ConstFetch preludes before file_get_contents() with
trailing embedded offset/length literals were not collected as producers
when only some call args were dead inline temps. Accept distinct hoisted
temps with trailing embedded literals so the data:// path reaches the
builtin instead of an empty path ValueError.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 726a091 into master Jul 13, 2026
@PurHur PurHur deleted the agent/issue-18613-file-get-contents-data-offset branch July 13, 2026 14:32
PurHur added a commit that referenced this pull request Jul 13, 2026
… (#18641)

Regenerate docs/bootstrap-inventory.md so bootstrap-inventory --check
and ci-fast generated-doc gate pass after #18622 added inline concat
producer wiring methods to lib/Compiler.php.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
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: file_get_contents() data:// offset/length — ValueError Path cannot be empty (ext/standard/streams.c, re-#10263)

1 participant