Edit report at https://bugs.php.net/bug.php?id=62956&edit=1

 ID:                 62956
 Comment by:         lsm...@php.net
 Reported by:        lsm...@php.net
 Summary:            "incompatible" signatures for private methods should
                     not cause E_STRICT
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 PHP Version:        5.4.6
 Block user comment: N
 Private report:     N

 New Comment:

BTW: A temporary fix is to simply rename the method in the extending class.


Previous Comments:
------------------------------------------------------------------------
[2012-08-28 10:58:59] lsm...@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

Reply via email to