Edit report at https://bugs.php.net/bug.php?id=63816&edit=1

 ID:                 63816
 User updated by:    kotlyar dot maksim at gmail dot com
 Reported by:        kotlyar dot maksim at gmail dot com
 Summary:            implementation child interface and after parent
                     cause fatal error.
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   linux
-PHP Version:        5.4.10
+PHP Version:        5.4.7
 Block user comment: N
 Private report:     N

 New Comment:

Change php version


Previous Comments:
------------------------------------------------------------------------
[2012-12-20 15:29:23] kotlyar dot maksim at gmail dot com

Description:
------------
Order of implemented interfaces should make any difference. But it is not the 
case. If I implement child interface and parent after I will get a fatal error


Test script:
---------------
<?php
ini_set('display_errors', 1);
error_reporting(-1);


interface RootInterface
{
    function foo();
}

interface FirstChildInterface extends RootInterface
{
    function foo();
}

interface SecondChildInterface extends RootInterface
{
    function foo();
}

//works fine.
class A implements FirstChildInterface, SecondChildInterface
{
    function foo()
    {
    }
}

//also ok.
class B implements RootInterface, FirstChildInterface
{
    function foo()
    {
    }
}

//there is a fatal error.
class C implements FirstChildInterface, RootInterface 
{
    function foo()
    {
    }
}

Expected result:
----------------
Should work without errors(as previous examples).

Actual result:
--------------
PHP Fatal error:  Class C cannot implement previously implemented interface 
RootInterface in /foo/test.php on line 35
PHP Stack trace:
PHP   1. {main}() /foo/test.php:0

Fatal error: Class C cannot implement previously implemented interface 
RootInterface in /foo/test.php on line 35

Call Stack:
    0.0008     238784   1. {main}() /foo/test.php:0


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63816&edit=1

Reply via email to