Bug #72034 [Opn->Ver]: abstract classes' method compatibility is checked the other way round
| From: | krakjoe@php.net | Date: | Sat, 16 Apr 2016 07:22:05 +0000 |
| Subject: | Bug #72034 [Opn->Ver]: abstract classes' method compatibility is checked the other way round | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200582@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72034&edit=1
ID: 72034
Updated by: krakjoe@php.net
Reported by: youwishspambot at example dot org
Summary: abstract classes' method compatibility is checked
the other way round
-Status: Open
+Status: Verified
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.0.5
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2016-04-15 17:42:58] youwishspambot at example dot org
Description:
------------
https://3v4l.org/LKFbZ
and it's a problem for optional parameters:
Test script:
---------------
interface AAA{
function method($x);
}
interface BBB extends AAA{
function method($x, $y = null);
}
// this works correctly:
class AA_ implements AAA{
function method($x){}
}
class BB_ extends AA_ implements BBB{
function method($x, $y = null){}
}
(new BB_())->method(1, 1);
// this doesn't:
abstract class AAA_ implements AAA{}
abstract class BBB_ extends AAA_ implements BBB{}
// AAA::method is checked to be compatible against BBB::method,
// while it should happen the opposite
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72034&edit=1