Skip to content

Language: incomplete interface implementation compile-time fatal (Zend zend_inheritance.c parity) #3386

Closed

Description

@PurHur

Category

language

Problem

When a class implements an interface but omits a required method, Zend fails at compile time:

Fatal error: Class C contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (I::f)

This compiler accepts the class and runs it — verified May 2026:

interface I { public function f(): int; }
class C implements I {}
echo "ok\n"; // prints ok on bin/vm.php

php-src reference

Repro (failure today)

<?php
interface I { public function f(): int; }
class C implements I {}
echo "ok\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php; echo vm:$?'
# prints ok, vm:0 (wrong)

php repro.php; echo zend:$?
# zend:255 — Fatal error: Class C contains 1 abstract method…

Variant: wrong signature

interface I { public function f(): int; }
class C implements I { public function f(): string { return 'x'; } }

Zend: return type compatibility error at compile time (coordinate with #3323 variance).

Scope

Module Path
Compiler lib/Compiler.php — after compileClassLike, verify interface method set
VM optional runtime guard on TYPE_DECLARE_CLASS for eval/includes
Inheritance reuse method tables from #101 / #144
Tests test/compliance/cases/language/interface_missing_method.phpt

Done when

  • Missing method repro → compile-time fatal (message matches Zend subset)
  • Class with all methods implemented → compiles and runs
  • Multiple interfaces — report first missing method or aggregate count like Zend
  • ./script/ci-fast.sh --filter interface_missing green

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 29, 2026
  2. PurHur commented on May 29, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-c — starting this run

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