php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72034 abstract classes' method compatibility is checked the other way round
Submitted: 2016-04-15 17:42 UTC Modified: 2016-04-16 07:22 UTC
From: youwishspambot at example dot org Assigned:
Status: Verified Package: Scripting Engine problem
PHP Version: 7.0.5 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: youwishspambot at example dot org
New email:
PHP Version: OS:

 

 [2016-04-15 17:42 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-16 07:22 UTC] krakjoe@php.net
-Status: Open +Status: Verified
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC