|  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
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: 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.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2016-01-13 12:57 UTC]
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-14 13:05 UTC]
Closing as duplicate of which I will update the status on.
 [2016-03-26 21:50 UTC]
-Status: Open +Status: Duplicate
 [2016-03-26 21:50 UTC]
I think Dan forgot to update status ...
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 10:01:28 2024 UTC