php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71358 Order of interfaces is meaningful
Submitted: 2016-01-13 12:57 UTC Modified: 2016-03-26 21:50 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: danack@php.net Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.0.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: danack@php.net
New email:
PHP Version: OS:

 

 [2016-01-13 12:57 UTC] danack@php.net
Description:
------------
The check for whether a class is valid or not is dependent on what order the interfaces it implements are declared.

The example below is simple, to show the bug clearly.

A more realistic case would involve having multiple classes that implement various interfaces, including the "\Serializable" interface, and then realising that one of the user-defined interfaces should actually extend "\Serializable".

This would make some code break, depending on what order the implements interfaces was written as.

Test script:
---------------
interface Base
{
    const FOO = 5;
    function base();
}

interface Derived extends Base {
    function derived();
}

class ThisIsValid implements Base, Derived {
    public function base() {}
    public function derived() {}
}

class ThisWillError implements Derived, Base {
    public function base() {}
    public function derived() {}
}

Expected result:
----------------
No error, the definition of implements interfaces should not affect compilation.

Actual result:
--------------
Fatal error: Class ThisWillError cannot implement previously implemented interface Base in /in/Anc6g on line 18

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-14 13:05 UTC] danack@php.net
Closing as duplicate of https://bugs.php.net/bug.php?id=63816 which I will update the status on.
 [2016-03-26 21:50 UTC] krakjoe@php.net
-Status: Open +Status: Duplicate
 [2016-03-26 21:50 UTC] krakjoe@php.net
I think Dan forgot to update status ...
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Aug 04 06:01:26 2020 UTC