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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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: Sun Oct 06 07:01:27 2024 UTC