php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45186 __call depends on __callstatic in class scope
Submitted: 2008-06-05 12:26 UTC Modified: 2008-06-05 18:53 UTC
From: felipe@php.net Assigned: felipe (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-06-05 (CVS) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: felipe@php.net
New email:
PHP Version: OS:

 

 [2008-06-05 12:26 UTC] felipe@php.net
Description:
------------
The magic method __call depends on __callstatic to be called in *class scope*.

Adding:
	static public function __callstatic($a, $b) {
		print "__callstatic:\n";
		var_dump($a);
	}

The __call is called. Therefore, why dependency on __callstatic?

Reproduce code:
---------------
<?php

class bar  {
	public function __call($a, $b) {
		print "__call:\n";
		var_dump($this);
	}
	public function test() {
		self::ABC();
		bar::ABC();
		call_user_func(array('bar', 'abC'));
	}
}

$x = new bar;

$x->test();

Expected result:
----------------
__call:
object(bar)#1 (0) {
}
__call:
object(bar)#1 (0) {
}
__call:
object(bar)#1 (0) {
}


Actual result:
--------------
__call:
object(bar)#1 (0) {
}
__call:
object(bar)#1 (0) {
}

Warning: call_user_func() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'abc' in ...


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-05 18:53 UTC] felipe@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 12:01:31 2024 UTC