php.net |  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
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: lsmith@php.net Assigned: lstrojny (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.4.6 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: lsmith@php.net
New email:
PHP Version: OS:

 

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

Patches

Pull Requests

History

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

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2012-08-28 12:14 UTC] lstrojny@php.net
-Status: Assigned +Status: Feedback
 [2012-08-28 12:27 UTC] laruence@php.net
see #38772
 [2012-09-21 08:13 UTC] lstrojny@php.net
-Status: Feedback +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC