Skip to content

Language: unimplemented trait abstract method — fatal text/stream vs Zend (Zend/zend_compile.c) #25912

Closed

Description

@PurHur

Category

language · php-src-strict · traits / abstract methods

Problem

A concrete class that uses a trait with an unimplemented abstract method must compile-fatal like Zend. VM exits 255 but:

  1. Omits the PHP Fatal error: prefix
  2. Writes the message to stdout (Zend: stderr)
  3. Fails during whole-file compile so preceding statements (e.g. echo \"before\") never run — Zend runs bind-time check when the class declaration executes

Probed 2026-07-31 Zend 8.2.32 vs VM @ fad4609ee.

Repro Zend 8.2 VM
echo \"before\"; class C { use TAbs; } (trait has abstract function f()) stdout before; stderr PHP Fatal error: Class C contains 1 abstract method... only Class C contains 1 abstract method... on stdout; no before

php-src reference

PHP implementation target

  • Match Zend bind timing for trait abstract residuals (so prior opcodes run)
  • Emit PHP Fatal error: ... on stderr with exit 255
  • PHP-in-PHP compile/VM path; no new C

Repro

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_trait_abstract_unimplemented_fatal.php; php bin/vm.php test/repro/maintainer_gap_trait_abstract_unimplemented_fatal.php'

Done when

  • stdout includes before; stderr has PHP Fatal error: Class … abstract method
  • exit 255; no accepted
  • Compliance / repro guard; php-src-strict

Activity

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

    @PurHur
    OwnerAuthor

    claim: lane-B implementer (Composer) — starting this run

    Pre-claim gates: user_release_ready: yes; inventory OK 6647/6647; north-star5-fast ok on master. gen-0 seed stale (warning only).

    Branch: agent/issue-25912-trait-abstract-unimplemented-fatal

  3. PurHur commented on Jul 31, 2026

    @PurHur
    OwnerAuthor

    claim: lane-B implementer (Composer) — continuing this run (branch reset to current master; implementing)

    Gate snapshot:

    • docker: ok
    • release-readiness: north-star5-fast ok; inventory doc construct-flag drift (SessionGcRuntime); gen-0 seed stale (warning)
    • user_release_ready: checking in-branch
  4. PurHur commented on Jul 31, 2026

    @PurHur
    OwnerAuthor

    Merged via #25922

    Verification

    • Repro: VM stdout before; stderr PHP Fatal error: Class C contains 1 abstract method… (C::f); exit 255; no accepted (matches Zend).
    • TraitAbstractUnimplementedFatalTest OK (2)
    • compliance language/trait_abstract_unimplemented_fatal OK
    • related trait_abstract_* / enum_trait_abstract_* OK (4)

    Root cause: DECLARE_CLASS was hoisted before prior stmts; ClassValidator threw LogicException to stdout. Fix: source-order trait-using classes + CompileError → raiseClassDeclareCompileFatal.

  5. PurHur commented on Jul 31, 2026

    @PurHur
    OwnerAuthor

    Lane B verification (post-merge)

    Confirmed on master after #25922:

    VM exit 255
    stdout: before
    stderr: PHP Fatal error:  Class C contains 1 abstract method … (C::f)
    

    Compliance language/trait_abstract_unimplemented_fatal OK. No further work on this issue.

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 / JITarea:vmVirtual machinebugSomething 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