Skip to content

Language: JIT/AOT new $class variable classname (#27156) - #27177

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-27156-jit-new-var-class
Aug 3, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-27156-jit-new-var-class

Conversation

@PurHur

@PurHur PurHur commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Enable runtime classname resolution for non-literal new $class in EMBED JIT and AOT (LateStaticBindingHelper + allocateForRuntimeClassId), with __construct dispatch via RuntimeIndirectInstanceMethodCall / NoOpConstruct.
  • Fix $class / get_class falsely suppressing MCJIT embed bootstrap (JitMcjitEmbed declaration-shaped regex).
  • Harden try/catch + stream nested-compile paths that blocked the issue repro (InstantiableClassJitGuard null jit, stdout globals, JitIsResource stubs).

Closes #27156

php-src reference

  • Zend/zend_compile.c — zend_compile_new / ZEND_FETCH_CLASS
  • Zend/zend_execute.c — ZEND_NEW

Test plan

  • Issue repro (Zend / VM / JIT / AOT) — all print stdClass / Exception:boom:
./script/docker-exec.sh -- bash -lc '
php test/repro/new_var_classname.php
php bin/vm.php test/repro/new_var_classname.php
php bin/jit.php test/repro/new_var_classname.php
./phpc build -o /tmp/nv test/repro/new_var_classname.php && /tmp/nv
'
  • vendor/bin/phpunit --filter testInjectsBootstrapWhenOnlyClassVariableOrGetClass test/unit/JitMcjitEmbedTest.php
  • Invalid classname throws Error on Zend/VM

Not covered

Made with Cursor

Enable runtime classname resolution for non-literal `new` in EMBED and AOT,
dispatch __construct by class_id, and stop `$class`/get_class from suppressing
the MCJIT embed bootstrap (false `\bclass\b` match).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit b0d6080 into master Aug 3, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-27156-jit-new-var-class branch August 3, 2026 06:23
@PurHur
PurHur restored the agent/issue-27156-jit-new-var-class branch August 3, 2026 06:23
PurHur added a commit that referenced this pull request Aug 3, 2026
Master raced Language JIT new \$class during the prior refresh; honest argv
rebuild stamps fingerprint 77156ada… (verified-fresh). Functional smoke OK.

Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 3, 2026
Master raced Language JIT new \$class during the prior refresh; honest argv
rebuild stamps fingerprint 77156ada… (verified-fresh). Functional smoke OK.

Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 3, 2026
#27177 added lib/JIT/Call/NoOpConstruct.php to inventory without spine
require_once; north-star5-verify-fast step 2 failed coverage. Add to spine
and sync footnotes (6858/6860). Sidecar blob refresh left for follow-up —
fast path does not relink.

Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 3, 2026
PurHur added a commit that referenced this pull request Aug 3, 2026
#27177 added NoOpConstruct to inventory without spine require_once; coverage
and inventory doc drift blocked north-star5-verify-fast. spine-sync --no-link
covers the unit (6858/6860) and regenerates footnotes; sidecar blob refresh
deferred (BOOTSTRAP_ALLOW_STALE_SIDECAR / make bootstrap-gen0-refresh-sidecar).

Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 3, 2026
#27178)

* Trust: refresh gen-0 argv fingerprint after #27170 preg_replace (Pillar 1) (#27174)

north-star5-verify-fast failed on lowering_source_fingerprint mismatch after
#27168 (1 lowering commit: #27170). Honest argv rebuild stamps fingerprint
2db0a475… (verified-fresh); functional smoke OK on build/ and committed path.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: re-stamp gen-0 argv fingerprint after #27177 new \$class (#27174)

Master raced Language JIT new \$class during the prior refresh; honest argv
rebuild stamps fingerprint 77156ada… (verified-fresh). Functional smoke OK.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: spine-cover NoOpConstruct from #27177 (#27174)

#27177 added lib/JIT/Call/NoOpConstruct.php to inventory without spine
require_once; north-star5-verify-fast step 2 failed coverage. Add to spine
and sync footnotes (6858/6860). Sidecar blob refresh left for follow-up —
fast path does not relink.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: re-stamp gen-0 argv fingerprint after #27179 inet AOT (#27174)

Master raced inet_pton/ntop NestedJIT during the prior refresh; honest argv
rebuild stamps fingerprint 7cd43894… (verified-fresh). Functional smoke OK.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Revert "Trust: spine-cover NoOpConstruct from #27177 (#27174)"

This reverts commit f6692c1.

* Trust: refresh InetJitHelper helper-runtime prelink (#27174)

#27179 left ext_standard_InetJitHelper_php stale in the committed tier,
blocking release-readiness helper-runtime-prelink. Republish fingerprint-
matched unit (359 fresh, 0 stale).

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: spine-cover NoOpConstruct + inventory regen (#27174)

#27177 added NoOpConstruct to inventory without spine require_once; coverage
and inventory doc drift blocked north-star5-verify-fast. spine-sync --no-link
covers the unit (6858/6860) and regenerates footnotes; sidecar blob refresh
deferred (BOOTSTRAP_ALLOW_STALE_SIDECAR / make bootstrap-gen0-refresh-sidecar).

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

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 Aug 3, 2026
Enable runtime classname resolution for non-literal `new` in EMBED and AOT,
dispatch __construct by class_id, and stop `$class`/get_class from suppressing
the MCJIT embed bootstrap (false `\bclass\b` match).

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 Aug 3, 2026
#27178)

* Trust: refresh gen-0 argv fingerprint after #27170 preg_replace (Pillar 1) (#27174)

north-star5-verify-fast failed on lowering_source_fingerprint mismatch after
#27168 (1 lowering commit: #27170). Honest argv rebuild stamps fingerprint
2db0a475… (verified-fresh); functional smoke OK on build/ and committed path.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: re-stamp gen-0 argv fingerprint after #27177 new \$class (#27174)

Master raced Language JIT new \$class during the prior refresh; honest argv
rebuild stamps fingerprint 77156ada… (verified-fresh). Functional smoke OK.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: spine-cover NoOpConstruct from #27177 (#27174)

#27177 added lib/JIT/Call/NoOpConstruct.php to inventory without spine
require_once; north-star5-verify-fast step 2 failed coverage. Add to spine
and sync footnotes (6858/6860). Sidecar blob refresh left for follow-up —
fast path does not relink.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: re-stamp gen-0 argv fingerprint after #27179 inet AOT (#27174)

Master raced inet_pton/ntop NestedJIT during the prior refresh; honest argv
rebuild stamps fingerprint 7cd43894… (verified-fresh). Functional smoke OK.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Revert "Trust: spine-cover NoOpConstruct from #27177 (#27174)"

This reverts commit f6692c1.

* Trust: refresh InetJitHelper helper-runtime prelink (#27174)

#27179 left ext_standard_InetJitHelper_php stale in the committed tier,
blocking release-readiness helper-runtime-prelink. Republish fingerprint-
matched unit (359 fresh, 0 stale).

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: spine-cover NoOpConstruct + inventory regen (#27174)

#27177 added NoOpConstruct to inventory without spine require_once; coverage
and inventory doc drift blocked north-star5-verify-fast. spine-sync --no-link
covers the unit (6858/6860) and regenerates footnotes; sidecar blob refresh
deferred (BOOTSTRAP_ALLOW_STALE_SIDECAR / make bootstrap-gen0-refresh-sidecar).

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur deleted the agent/issue-27156-jit-new-var-class branch August 5, 2026 08:12
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.

Language: JIT new $class (variable classname) — LogicException resolveClassId (Zend/zend_compile.c)

1 participant