#45186 [Asn->Csd]: __call depends on __callstatic in class scope
| From: | felipe@php.net | Date: | Thu, 05 Jun 2008 18:53:30 +0000 |
| Subject: | #45186 [Asn->Csd]: __call depends on __callstatic in class scope | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125536@lists.php.net to get a copy of this message | ||
ID: 45186
Updated by: felipe@php.net
Reported By: felipe@php.net
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
PHP Version: 5.3CVS-2008-06-05 (CVS)
Assigned To: felipe
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2008-06-05 12:26:12] 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 ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45186&edit=1