Skip to content

Fix AOT superglobal refresh for standalone binaries (#12039)#12063

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-12039-simpleweb-aot-smoke
Jun 26, 2026
Merged

Fix AOT superglobal refresh for standalone binaries (#12039)#12063
PurHur merged 1 commit into
masterfrom
agent/issue-12039-simpleweb-aot-smoke

Conversation

@PurHur

@PurHur PurHur commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Default standalone AOT __superglobals__refresh to SuperglobalRefreshStandaloneLlvm — the PHP-in-PHP bridge (SuperglobalRefreshJitHelper) returns VM HashTable handles that coerceToHashtablePtr bitcasts to native __hashtable__*, yielding empty $_REQUEST and intermittent munmap_chunk (Release v1.1.0: fix examples 000–009 AOT smoke regression (001-SimpleWeb munmap_chunk) #12039).
  • Link multipart LLVM helpers whenever standalone LLVM refresh is active (StringMultipart).
  • Cast $_REQUEST['name'] in examples/001-SimpleWeb so repeated htmlspecialchars($name) is stable until the separate string-lifetime bug is fixed.
  • Opt-in PHP bridge experiments: PHP_COMPILER_SUPERGLOBAL_REFRESH_PHP=1.

php-src ref: main/php_variables.c — superglobal registration; LLVM path mirrors prior superglobals_refresh.c semantics.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter RuntimeSuperglobalRefreshTest::testTwoRequestsDifferentQueryString test/aot/RuntimeSuperglobalRefreshTest.php'
# OK (1 test, 7 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./script/examples-aot-smoke.sh 2>&1 | grep 001-SimpleWeb'
# examples-aot-smoke: 001-SimpleWeb: ok

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter SuperglobalsRefreshRuntimeStandaloneTest test/unit/JIT/SuperglobalsRefreshRuntimeStandaloneTest.php'
# OK (3 tests)

Note: full examples-aot-smoke.sh still fails at 003-MiniWebApp link on master (IncludeBindingEmitHelper TypeError) — pre-existing, out of #12039 scope.

Closes #12039

Made with Cursor

Default standalone AOT to SuperglobalRefreshStandaloneLlvm because nested
SuperglobalRefreshJitHelper returns VM HashTable handles that cannot coerce
to native __hashtable__* (empty $_REQUEST / munmap). Cast $_REQUEST name in
001-SimpleWeb for stable double htmlspecialchars. Opt-in PHP bridge via
PHP_COMPILER_SUPERGLOBAL_REFRESH_PHP=1.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 0485a14 into master Jun 26, 2026
@PurHur PurHur deleted the agent/issue-12039-simpleweb-aot-smoke branch June 26, 2026 10:30
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.

Release v1.1.0: fix examples 000–009 AOT smoke regression (001-SimpleWeb munmap_chunk)

1 participant