Req #53826 [Opn->Csd]: __callStatic fired in base class through a parent call if the method is private
Edit report at https://bugs.php.net/bug.php?id=53826&edit=1
ID: 53826
Updated by: nikic@php.net
Reported by: ingun at live dot fr
Summary: __callStatic fired in base class through a parent
call if the method is private
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Class/Object related
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=db2e2af13ab6b40d8a3042520e25f2775bcc00a8
Log: Fixed bug #53826
Previous Comments:
------------------------------------------------------------------------
[2011-01-24 01:24:19] ingun at live dot fr
Description:
------------
In a base class, a private non static method called by an extended class with
parent::
triggers __callStatic, while __call could have been expected.
If this private method is not defined at all, __call is triggered. (which seems
right according to http://bugs.php.net/bug.php?id=52713 )
The same behaviour for both cases should be suitable.
Test script:
---------------
class A1 {
public function __call($method, $args) { echo "__call"; }
public static function __callStatic($method, $args) { echo "__callStatic"; }
}
class A2 { // A1 with private function test
public function __call($method, $args) { echo "__call"; }
public static function __callStatic($method, $args) { echo "__callStatic"; }
private function test() {}
}
class B1 extends A1 {
public function test(){ parent::test(); }
}
class B2 extends A2 {
public function test(){ parent::test(); }
}
$test1 = new B1;
$test2 = new B2;
$test1->test();
$test2->test();
Expected result:
----------------
__call__call
// or __callStatic__callStatic, but the same behaviour for both
Actual result:
--------------
__call__callStatic
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=53826&edit=1
Thread (2 messages)