|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-01-14 13:05 UTC] danack@php.net
[2016-03-26 21:50 UTC] krakjoe@php.net
-Status: Open
+Status: Duplicate
[2016-03-26 21:50 UTC] krakjoe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 13:00:01 2025 UTC |
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