Bug #69317 [NEW]: Incorrect LSP check when extending multiple interfaces

From: Date: Fri, 27 Mar 2015 14:01:04 +0000
Subject: Bug #69317 [NEW]: Incorrect LSP check when extending multiple interfaces
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191639@lists.php.net to get a copy of this message
From: nikic Operating system: PHP version: master-Git-2015-03-27 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Incorrect LSP check when extending multiple interfaces Description: ------------ <?php class X {} interface A extends IteratorAggregate { function getIterator() : X; } interface B extends IteratorAggregate, A { } Fatal error: Declaration of IteratorAggregate::getIterator() must be compatible with A::getIterator(): X in /home/nikic/php-src/t030.php on line 9 This happens because we first inherit the IteratorAggregate::getIterator() method and then check it against the A::getIterator() method - which is of course wrong. This is a problem with return types, because they are not fully invariant - not sure if it might also be a problem for some things before PHP 7. -- Edit bug report at https://bugs.php.net/bug.php?id=69317&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69317&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69317&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69317&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69317&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69317&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69317&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69317&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69317&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69317&r=support Expected behavior: https://bugs.php.net/fix.php?id=69317&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69317&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69317&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69317&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69317&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69317&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69317&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69317&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69317&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69317&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69317&r=mysqlcfg

« previous php.bugs (#191639) next »