Skip to content

Language: final plain properties still accepted on reference profile — Zend compile fatal; PROFILE=8.4 isFinal/override broken (re-#24686, Zend/zend_compile.c) #24992

Closed

Description

@PurHur

Category

language · php-src-strict · final properties / inheritance

Problem

On the reference (8.2) profile, Zend rejects final on plain properties with a compile fatal. bin/vm.php still accepts the declaration, allows writes, and allows a child class to redeclare the property.

Under PHP_COMPILER_PROFILE=8.4, Zend 8.4 allows the declaration but ReflectionProperty::isFinal() is 1 and a child override is a compile fatal. VM reports isFinal=0 and eval of a child override succeeds (override_ok).

Probed 2026-07-29 on host Zend 8.2.32 / Zend 8.4.23 (php:8.4-cli) vs bin/vm.php @ current master.

Repro Zend VM
default profile: class A { public final string $x = "a"; } E_COMPILE_ERROR: final only for methods/classes/constants prints compiled, child override + write succeed
PHP_COMPILER_PROFILE=8.4: same + ReflectionProperty::isFinal() isFinal=1 isFinal=0
PHP_COMPILER_PROFILE=8.4: class B extends A { public string $x = "b"; } Cannot override final property A::$x override_ok

php-src reference

PHP implementation target

  • lib/ compile / class property metadata — reject final on plain properties when supportsFinalProperties() is false (reference profile)
  • PROFILE=8.4: set/retain final flag on property info; enforce on inheritance; expose ReflectionProperty::isFinal()
  • Prefer PHP-in-PHP lowering/metadata; no new C runtime logic

Repro

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_final_plain_property.php; php bin/vm.php test/repro/maintainer_gap_final_plain_property.php'
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_final_property_profile84.php'
# Zend 8.4 reference: php:8.4-cli on the same PROFILE=8.4 script

Done when

  • Default/reference profile: declaring public final string $x matches Zend compile fatal (no runtime accept/write/override)
  • PHP_COMPILER_PROFILE=8.4: ReflectionProperty::isFinal() true; child redeclaration compile-fatals like Zend 8.4
  • Compliance / repro guards under test/compliance/cases/ + test/repro/
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 29, 2026
  2. PurHur commented on Jul 29, 2026

    @PurHur
    OwnerAuthor

    Maintainer gate note (2026-07-29) — #10533 comments locked

    Could not paste onto #10533 (2500+ comment lock). Snapshot from this maintainer run:

    Gate Status Symptom
    docker info green OK
    inventory --check / release-readiness on #24985 tree green OK 6638/6638, user_release_ready: yes
    check-helper-runtime-prelink.php --strict on tip after later merges red 298 fresh, 1 stale (ParseUrlJitHelper)
    gen-0 provenance stale 9e6b9c12a (43d); restamp warning only

    Sibling filings this run: #24993 (opcache name), #24994 (pgsql phantom), #24995 (adoptNode 8.2 NYI gating). PR #24988 left open — vendor patch fails git apply --check.

  3. PurHur commented on Jul 29, 2026

    @PurHur
    OwnerAuthor

    claim: Lane C implementer — starting this run

    Gate probe (pre-claim):

    • docker info: green
    • bootstrap-inventory --check: stale doc drift vs tip (regenerate needed; not blocking this language fix)
    • release-readiness --json: still running
    • Issue: no open PR, no recent claim
  4. PurHur commented on Jul 29, 2026

    @PurHur
    OwnerAuthor

    Worker lane A — no eligible claim this run (2026-07-29)

    Gate snapshot (local Docker, not GHA):

    Gate Status Note
    php script/bootstrap-inventory.php --check partial doc drift vs live (warnings 21406→21405; not a link failure)
    make north-star5-verify-fast green EXIT 0; gen-0 manifest unverified-restamp warning only; VM driver probe OK via prelinked seed
    ./script/release-readiness.sh --json pending/partial run in flight / long — north-star5-fast already green above
    In-flight PR #24988 merged mid-run (php-vendor-implicit-nullable-84)

    Lane A eligibility scan (n % 3 == 0, prefer language)

    Stopped without claiming — do not steal from other lanes / automation owners. Next useful Lane A language ticket: file or relabel an implementation-ready phase-2:language issue with number % 3 == 0.

  5. PurHur commented on Jul 29, 2026

    @PurHur
    OwnerAuthor

    Merged #25007.

    Fix: inheritFromParent now rejects child redeclaration of a parent staticPropertyFinal across eval (same Zend message as instance finals). Same-script compile was already covered by FinalPropertyOverrideCheck.

    Verified:

    php bin/vm.php test/repro/maintainer_gap_final_plain_property.php
    # Fatal: Cannot declare property A::$x final… exit 255
    
    PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_final_property_profile84.php
    # isFinal=1 + Fatal: Cannot override final property A::$x
    
    PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_24992_final_static_property_eval_override.php
    # isFinal=1 + Fatal (was override_ok before fix)
    
    vendor/bin/phpunit --filter final_static_property_eval_override_84 test/compliance/VMTest.php test/compliance/JITTest.php
    # OK (VM); JIT skipped MCJIT eval deferral like sibling final-eval cases
    
  6. PurHur commented on Jul 29, 2026

    @PurHur
    OwnerAuthor

    Worker lane A follow-up — Pillar 1 patch apply fixed

    After the empty-queue note: master was red on apply-patches / north-star5-verify-fast because #24988’s php-vendor-implicit-nullable-84.patch hunks did not match post-overlay vendor.

    Merged #25008 — regenerated Func/Property/Parser context hunks.

    Verified:

    • script/apply-patches.sh ×2 (apply + skip idempotent)
    • make north-star5-verify-fast → OK (fast)

    Lane A still has no eligible phase-2:language implementation-ready ticket (n%3==0); #24992 remains lane C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions