Bug #71358 [Opn]: Order of interfaces is meaningful
Edit report at https://bugs.php.net/bug.php?id=71358&edit=1
ID: 71358
Updated by: danack@php.net
Reported by: danack@php.net
Summary: Order of interfaces is meaningful
Status: Open
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.0.2
Block user comment: N
Private report: N
New Comment:
Closing as duplicate of https://bugs.php.net/bug.php?id=63816 which I will
update the status on.
Previous Comments:
------------------------------------------------------------------------
[2016-01-13 12:57:56] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71358&edit=1
Thread (3 messages)