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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC