Skip to content

Fix user-script AOT multipart $_FILES populate (#15624)#18449

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-15624-files-isset-aot
Jul 13, 2026
Merged

Fix user-script AOT multipart $_FILES populate (#15624)#18449
PurHur merged 2 commits into
masterfrom
agent/issue-15624-files-isset-aot

Conversation

@PurHur

@PurHur PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #15624examples/006-FileUploadWeb AOT execute no longer populates nested $_FILES after multipart POST.

Root cause: #18115 routed all POST bodies through MultipartNativeJitHelper via __compiler_multipart_populate_post_body, but the compiled PHP helper bridge did not populate native sg_* at runtime (regression from deleting StringMultipartStandaloneLlvm). Urlencoded POST was also broken because the urlencoded fast path was removed.

Fix:

  1. Restore native LLVM multipart (__phpc_parse_multipart_post via StringMultipartStandaloneLlvm) for user-script AOT refresh; keep urlencoded POST on __compiler_parse_str.
  2. isset($_FILES['field']) — exclude _FILES from peekStringKeyValue fast path (nested upload entries are hashtables).
  3. Harden MultipartRuntime no-op stub vs real bridge entry ordering.

Verification

source script/php-env.sh
FILE_UPLOAD_WEB_AOT_SMOKE_GATE=1 vendor/bin/phpunit --filter FileUploadWebAotExecuteTest
# OK (1 test)

vendor/bin/phpunit --filter RuntimeSuperglobalRefreshTest::testNestedFilesFieldAot
# OK

vendor/bin/phpunit --filter RuntimeSuperglobalRefreshTest::testTwoRequestsDifferentPostBody
# OK

vendor/bin/phpunit --filter MultipartRuntimeShrinkTest
# OK (3 tests)

make bootstrap-selfhost-vm-driver-execute-probe
# bootstrap-selfhost-vm-driver-execute-probe: OK

Note: RuntimeSuperglobalRefreshTest::testMultipartPostBody still fails on master (uses REQUEST_BODY_FILE; user-script LLVM refresh reads REQUEST_BODY only) — separate gap.

Closes #15624

Secondary fix for FileUploadWeb AOT: compileSuperglobalNullReadIsset
uses peekStringKeyValue (string slots only) but upload entries are nested
hashtables. Exclude _FILES from that fast path.

Primary multipart populate still broken — not merge-ready.

Co-authored-by: Cursor <cursoragent@cursor.com>
Restore native LLVM multipart refresh (__phpc_parse_multipart_post) for
user-script standalone AOT — the #18115 MultipartNativeJitHelper bridge
did not populate sg_* at runtime. Re-split urlencoded POST to
__compiler_parse_str (working path). Exclude _FILES from isset
peekStringKey fast path so nested upload hashtables are visible.

Verification: FILE_UPLOAD_WEB_AOT_SMOKE_GATE=1 vendor/bin/phpunit --filter FileUploadWebAotExecuteTest
  vendor/bin/phpunit --filter RuntimeSuperglobalRefreshTest::testNestedFilesFieldAot
  vendor/bin/phpunit --filter MultipartRuntimeShrinkTest
  make bootstrap-selfhost-vm-driver-execute-probe
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur changed the title WIP: FileUploadWeb AOT — isset($_FILES) nested hashtable guard (#15624) Fix user-script AOT multipart $_FILES populate (#15624) Jul 13, 2026
@PurHur PurHur merged commit 0cd4f6d into master Jul 13, 2026
@PurHur PurHur deleted the agent/issue-15624-files-isset-aot branch July 13, 2026 07:59
PurHur added a commit that referenced this pull request Jul 13, 2026
…1492) (#18548)

#18449 restored StringMultipartStandaloneLlvm which calls __phpc_parse_str_*
subhelpers, but #18466 had removed ParseStrUserScriptDelimitedJit. Re-wire
ensureSubhelpers in ParseStrRuntime::ensureUserScriptLinked so user-script
multipart/superglobal refresh links at AOT build time.

Verification: ./script/check-aot-build-smoke.sh
  php vendor/bin/phpunit --filter SuperglobalsBracketRuntimeStandaloneTest

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Jul 13, 2026
Add 12 missing require_once entries to compiler_lib_spine_smoke so Phase A
inventory (4769/4769) matches the vm.php closure after #18541/#18547/#18449/#18548.

Closes #18550

Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Jul 13, 2026
…18558)

Add 12 missing require_once entries to compiler_lib_spine_smoke so Phase A
inventory (4769/4769) matches the vm.php closure after #18541/#18547/#18449/#18548.

Closes #18550

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: 006-FileUploadWeb AOT execute — multipart POST no longer populates $_FILES, binary renders empty state (lib/Web/MultipartParser.php)

1 participant