Bug #62956 [Opn->Asn]: "incompatible" signatures for private methods should not cause E_STRICT
| From: | lstrojny@php.net | Date: | Tue, 28 Aug 2012 11:41:20 +0000 |
| Subject: | Bug #62956 [Opn->Asn]: "incompatible" signatures for private methods should not cause E_STRICT | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172977@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62956&edit=1
ID: 62956
Updated by: lstrojny@php.net
Reported by: lsmith@php.net
Summary: "incompatible" signatures for private methods should
not cause E_STRICT
-Status: Open
+Status: Assigned
Type: Bug
Package: Unknown/Other Function
PHP Version: 5.4.6
-Assigned To:
+Assigned To: lstrojny
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2012-08-28 11:02:32] lsmith@php.net
BTW: A temporary fix is to simply rename the method in the extending class.
------------------------------------------------------------------------
[2012-08-28 10:58:59] lsmith@php.net
Description:
------------
Defining a private method in an extending class that matches the name of a private
method in a parent class with a different signature currently triggers an
E_STRICT. As the extending class shouldn't see the parent private methods, there
is no reason to trigger an E_STRICT in this case.
Test script:
---------------
<?php
class A
{
private function foo($bar)
{
}
}
class B extends A
{
private function foo()
{
}
}
Expected result:
----------------
no E_STRICT error
Actual result:
--------------
PHP Strict standards: Declaration of B::foo() should be compatible with
A::foo($bar) in /Users/lsmith/htdocs/foo.php on line 15
Strict standards: Declaration of B::foo() should be compatible with A::foo($bar)
in /Users/lsmith/htdocs/foo.php on line 15
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62956&edit=1