Skip to content

Language: PROFILE=8.4 final plain property compile accepted — Zend isFinal/override fatal (re-#24992, Zend/zend_compile.c) #29762

Closed

Description

@PurHur

Category

Language · php-src-strict · PHP 8.4 final plain properties

Problem

With PHP_COMPILER_PROFILE=8.4, the compiler accepts public final string $x and reports ReflectionProperty::isFinal() === false. Child classes can override the property without error. Zend 8.4 rejects redeclaration and exposes isFinal() === true.

#24992 was closed but probed 2026-08-10 the VM path is still wrong.

Repro Zend 8.4 (reference) VM PROFILE=8.4
public final string $x in class A ReflectionProperty::isFinal() true isFinal() false
Child redeclares $x compile/runtime fatal override_ok (no error)

php-src reference

PHP implementation target

  • lib/ compile-time property flags + ext/reflection PHP port — enforce final plain properties on PROFILE≥8.4; PHP-in-PHP lowering

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_final_property_re24992.php'
# expect: ok (isFinal true, child override fatal)
# actual: fail: ReflectionProperty::isFinal() false

Done when

  • final on plain typed properties parsed and enforced on PROFILE=8.4
  • ReflectionProperty::isFinal() matches Zend
  • Child override throws Zend-shaped fatal
  • Compliance .phpt under test/compliance/cases/language/
  • 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 Aug 10, 2026
  2. PurHur commented on Aug 10, 2026

    @PurHur
    OwnerAuthor

    claim: Worker lane C (implementer) — starting this run

    Prior claim #29768 closed as not-a-bug (Zend matches VM read-only message; re-#26006).
    Gates: north-star5-fast OK; spine-coverage RED on TypedParamCoerce (#29781 lane A); open PRs none.
    Lane C: #29762 % 3 == 2.

  3. PurHur commented on Aug 10, 2026

    @PurHur
    OwnerAuthor

    Resolution: already fixed on master (re-#24992)

    Probed this run under PHP_COMPILER_PROFILE=8.4 — behavior already matches Zend 8.4.

    VM (host)

    PHP_COMPILER_PROFILE=8.4 php -d memory_limit=1536M bin/vm.php test/repro/maintainer_gap_final_property_profile84.php
    # isFinal=1
    # Fatal error: Cannot override final property A::$x … exit 255

    Same-file child redeclaration and ctor-declared public final string $x also compile-fatal with Cannot override final property A::$x (exit 255). Related repros (maintainer_gap_final_plain_property_84.php, issue_28393_final_plain_isfinal.php, reflection_property_is_final_plain.php) print isFinal=1.

    Zend 8.4 reference

    isFinal=1
    Fatal error: Cannot override final property A::$x …
    

    Existing guards

    Filed Done-when is already satisfied; issue repro path maintainer_gap_final_property_re24992.php was never committed — use maintainer_gap_final_property_profile84.php instead.

    Closing as already fixed. No code change / PR.

  4. PurHur commented on Aug 10, 2026

    @PurHur
    OwnerAuthor

    Already fixed on master (merged #25007 / #24992). PROFILE=8.4 VM matches Zend: isFinal=1 + child override Fatal. See verification comment.

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