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: Closed Package: Class/Object related
PHP Version: 5.3.5 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: ingun at live dot fr
New email:
PHP Version: OS:

 

 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-18 13:17 UTC] nikic@php.net
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
 [2021-02-18 13:17 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Feb 03 03:01:30 2025 UTC