| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2007-11-05 15:50 UTC] smith at pooteeweet dot org
 Description:
------------
PHP 5.3.0-dev (cli) (built: Nov  5 2007 16:42:56) from todays CVS HEAD.
The implementation of interfaces in concrete abstract classes and their inheritence is not possible:
Reproduce code:
---------------
<?php
    interface A {
        function foo();
    }
    abstract class B implements A {
        abstract public function foo();
    }
    class C extends B {
        public function foo() {
            echo 'works';
        }
    }
    $o = new C();
    $o->foo();
?>
Expected result:
----------------
Echoing "works"
Actual result:
--------------
Fatal error: Can't inherit abstract function A::foo() (previously declared abstract in B) in ...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 00:00:01 2025 UTC | 
<?php interface A { function foo(); } abstract class B implements A { } class C extends B { public function foo() { echo 'works'; } } $o = new C(); $o->foo(); ?> If you don't want to implement a method from an interface, don't redeclare it, and the code will work as intended.