Skip to content

Language: implements clause — compile-time missing method fatal (Zend zend_inheritance.c parity) #3536

Closed

Description

@PurHur

Category

language

Problem

class C implements I { } parses and runs when interface methods are missing. Zend fails at compile time with a fatal error listing unimplemented interface methods.

This is called out as a gap on #144; split here for a single claimable fix.

php-src reference

  • Zend/zend_inheritance.c — zend_do_implement_interface(), zend_class_implements_interface()
  • Zend/zend_compile.c — interface method table vs class method table at declare time

Repro (today)

<?php
interface I {
    public function required(): int;
}
class C implements I {
}
new C();
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
# Zend: Fatal error: Class C contains 1 abstract method...
# This compiler: succeeds (no error)

Scope (this repo)

Layer Path
Compiler lib/Compiler.php — after class body compile, diff interface vtable vs class methods
VM Optional runtime guard if compile-time check deferred for dynamic includes
Tests test/compliance/cases/language/implements_missing_method.phpt

Done when

Related

Links

Activity

  1. added
    enhancementNew feature or request
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on May 30, 2026
  2. PurHur commented on May 30, 2026

    @PurHur
    OwnerAuthor

    claim: agent-lane-c — starting this run

  3. PurHur commented on May 30, 2026

    @PurHur
    OwnerAuthor

    Implementation already landed in #3386 (InterfaceImplementationCheck::validate()). This run adds issue-specified compliance PHPTs (implements_missing_method.phpt, implements_ok.phpt) and PR #3541. Verified repro fails at compile time with Zend-shaped message.

  4. added a commit that references this issue on May 30, 2026
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 machineenhancementNew feature or requestimplementation-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