[PHP-BUG] Bug #71248 [NEW]: Wrong interface is enforced
[email protected] ("norbert at linuxnetworks dot de")
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
From: norbert at linuxnetworks dot de Operating system: Ubuntu 14.04 PHP version: 7.0.1 Package: Class/Object related Bug Type: Bug Bug description:Wrong interface is enforced Description: ------------ I ran into a weired problem with interfaces in combination with namespaces. In the Aimeos library, decorators can be wrapped around provider objects. The provider objects use this constructor signature: public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Service\Item\Iface $serviceItem ); Decorators use this one: public function __construct( \Aimeos\MShop\Service\Provider\Iface $provider, \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Service\Item\Iface $serviceItem ); Both have their own interfaces (Provider/Factory/Iface.php and Provider/Decorator/Iface.php) and the Factory interface isn't used for decorators and vice versa. Despite that fact, PHP7 complains that the decorators doesn't implement the Factory interface. I've stripped the source code down as much as possible (classes and interfaces are mostly empty) and pushed it to a GitHub repository: https://github.com/nos3/php7 Furthermore, on travis-ci a test against 5.6 and 7.0 have been done: https://travis-ci.org/nos3/php7 Expected result: ---------------- No error like for PHP 5.6 Actual result: -------------- PHP Fatal error: Declaration of Aimeos\MShop\Service\Provider\Decorator\Base::__construct(Aimeos\MShop\Service\Provider\Iface $provider, Aimeos\MShop\Context\Item\Iface $context, Aimeos\MShop\Service\Item\Iface $serviceItem) must be compatible with Aimeos\MShop\Service\Provider\Factory\Iface::__construct(Aimeos\MShop\Context\Item\Iface $context, Aimeos\MShop\Service\Item\Iface $serviceItem) in /home/vagrant/Code/Laravel/php7/Provider/Decorator/Base.php on line 20 -- Edit bug report at https://bugs.php.net/bug.php?id=71248&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71248&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71248&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71248&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71248&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71248&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71248&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71248&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71248&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71248&r=support Expected behavior: https://bugs.php.net/fix.php?id=71248&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71248&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71248&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71248&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71248&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71248&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71248&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71248&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71248&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71248&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71248&r=mysqlcfg