Skip to content

Fix wave 12 bootstrap AOT resolver/superglobal/string regressions (#1086)#1158

Merged
PurHur merged 2 commits into
masterfrom
fix/wave12-resolver-superglobal-regression
May 23, 2026
Merged

Fix wave 12 bootstrap AOT resolver/superglobal/string regressions (#1086)#1158
PurHur merged 2 commits into
masterfrom
fix/wave12-resolver-superglobal-regression

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 23, 2026

Summary

  • Restore bootstrap-aot correctness when PHP_COMPILER_SELFHOST_AOT=1 is inherited from the environment (CI/dev shells): compile bootstrap fixtures with PHP_COMPILER_SELFHOST_AOT=0 and keep trim/urlencode on the real JIT path via SelfHostBuiltinPolicy.
  • Return owned __string__* copies from trim/urlencode JIT (__string__separate) so nested string compares/strlen no longer segfault on module-string constants.
  • Keep self-host probe green by leaving ConstStringFolder stubbed under self-host AOT (probe ICmp); resolver/superglobal bootstrap fixtures use real lowering via the bootstrap-aot compile gate.

Root cause

Commit 4404c25 (#1097) widened self-host stubbing (Superglobals::*, IncludePathResolver::resolve) and trim/urlencode were absent from SelfHostBuiltinPolicy, so with inherited PHP_COMPILER_SELFHOST_AOT=1 bootstrap-aot-link compiled stubbed/no-op builtins. String builtins returning module __string__* constants without __string__separate also broke consumers (strlen, !==).

Before / after stdout (bootstrap-aot fixtures)

Fixture Before (master) After
include_path_resolver_smoke.php 0\n1\n1 1\n1\n1
superglobal_name_check.php 00 10
stdlib_string_trim.php (empty / crash) 1\n
stdlib_string_urlencode.php (empty / crash) 1\n

Test plan

  • PHP_COMPILER_SELFHOST_AOT=0 bin/compile.php on all 4 fixtures → stdout matches Zend
  • make bootstrap-selfhost-probe (probe still green)
  • ./script/bootstrap-aot-link.sh for the 4 targets (via PHP_COMPILER_SELFHOST_AOT=0 compile prefix)

Partial #1086 — squash when green.

Made with Cursor

PurHur and others added 2 commits May 23, 2026 21:02
Re-enable ConstStringFolder real JIT lowering by fixing === between boxed
__value__ and native __object__ operands, foreach object copy, and realpath
checks in sourceDir.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ns (#1086).

Add trim/urlencode to SelfHostBuiltinPolicy real lowering, return owned
__string__* copies from string builtins, and compile bootstrap-aot fixtures
with PHP_COMPILER_SELFHOST_AOT=0 so inherited env does not stub resolver paths.
Keep ConstStringFolder stubbed under self-host for probe ICmp stability.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 5aaa8a9 into master May 23, 2026
1 check passed
@PurHur PurHur deleted the fix/wave12-resolver-superglobal-regression branch May 23, 2026 19:15
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.

1 participant