Bug #71358 [NEW]: Order of interfaces is meaningful
| From: | danack@php.net | Date: | Wed, 13 Jan 2016 12:57:59 +0000 |
| Subject: | Bug #71358 [NEW]: Order of interfaces is meaningful | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-198625@lists.php.net to get a copy of this message | ||
From: danack
Operating system:
PHP version: 7.0.2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Order of interfaces is meaningful
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 bug report at https://bugs.php.net/bug.php?id=71358&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71358&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71358&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71358&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71358&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71358&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71358&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71358&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71358&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71358&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71358&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71358&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71358&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71358&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71358&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71358&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71358&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71358&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71358&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71358&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71358&r=mysqlcfg