php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53826 __callStatic fired in base class through a parent call if the method is private
Submitted: 2011-01-24 01:24 UTC Modified: -
Votes:7
Avg. Score:4.0 ± 0.5
Reproduced:7 of 7 (100.0%)
Same Version:1 (14.3%)
Same OS:1 (14.3%)
From: ingun at live dot fr Assigned:
Status: Open Package: Class/Object related
PHP Version: 5.3.5 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-01-24 01:24 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Aug 25 20:01:27 2019 UTC