Bug #71358 [Opn->Dup]: Order of interfaces is meaningful

From: Date: Sat, 26 Mar 2016 21:50:26 +0000
Subject: Bug #71358 [Opn->Dup]: Order of interfaces is meaningful
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200128@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71358&edit=1 ID: 71358 Updated by: krakjoe@php.net Reported by: danack@php.net Summary: Order of interfaces is meaningful -Status: Open +Status: Duplicate Type: Bug Package: Scripting Engine problem PHP Version: 7.0.2 Block user comment: N Private report: N New Comment: I think Dan forgot to update status ... Previous Comments: ------------------------------------------------------------------------ [2016-01-14 13:05:40] danack@php.net Closing as duplicate of https://bugs.php.net/bug.php?id=63816 which I will update the status on. ------------------------------------------------------------------------ [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

« previous php.bugs (#200128) next »