#26739 [Com]: __call() doesn't work for static methods
| From: | ecentinela at gmail dot com | Date: | Fri, 16 Mar 2007 08:40:02 +0000 |
| Subject: | #26739 [Com]: __call() doesn't work for static methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-110423@lists.php.net to get a copy of this message | ||
ID: 26739
Comment by: ecentinela at gmail dot com
Reported By: demiurg at terra dot es
Status: Open
Bug Type: Feature/Change Request
Operating System: *
PHP Version: 5.0.0
New Comment:
Have been resolved this issue? There is some workaround?
Thanks
Previous Comments:
------------------------------------------------------------------------
[2003-12-29 08:07:21] helly@php.net
__call() doesn't offer anything to distinguish between static and
dynamic calls. So we'd need a new magic function say __static_call().
For 5.0.0 we have a feature freeze already, so this might take a while.
------------------------------------------------------------------------
[2003-12-29 07:50:16] demiurg at terra dot es
Description:
------------
Hello,
I'm not sure whether it is a bug or a feature, so I just point this out
and you decide.
__class() method works like OK for objects, but completely fails when
calling a class method (see Reproduce Code).
P.S. Before sending this report, I did a search on "__call" and have
found 11 bugs, none of which describes the issue.
Thanks!
Reproduce code:
---------------
<?php
class a {
static function __call($method, $params) {
echo "Called $method(".implode(', ', $params).")\n";
}
}
$c = new a;
$c->test(1, 2, 3);
a::test(3, 2, 1);
?>
Expected result:
----------------
Called test(1, 2, 3)
Called test(3, 2, 1)
Actual result:
--------------
Called test(1, 2, 3)
Fatal error: Call to undefined method a::test() in a.php on line 12
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26739&edit=1