|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62956 "incompatible" signatures for private methods should not cause E_STRICT
Submitted: 2012-08-28 10:58 UTC Modified: 2012-09-21 08:13 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: Assigned: lstrojny (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.4.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2012-08-28 10:58 UTC]
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:

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-28 11:02 UTC]
BTW: A temporary fix is to simply rename the method in the extending class.
 [2012-08-28 11:41 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: lstrojny
 [2012-08-28 12:01 UTC]
appears to be a duplicate of #61761
 [2012-08-28 12:12 UTC]
just skip the inherit method checking for private methods should works
 [2012-08-28 12:14 UTC]
Please try using this snapshot:
For Windows:

 [2012-08-28 12:14 UTC]
-Status: Assigned +Status: Feedback
 [2012-08-28 12:27 UTC]
see #38772
 [2012-09-21 08:13 UTC]
-Status: Feedback +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 11 04:01:27 2023 UTC