#33463 [Opn->WFx]: Unexpected Paamayim Nekudotayim in Dynamic Static Method Call
| From: | tony2001@php.net | Date: | Fri, 24 Jun 2005 10:44:07 +0000 |
| Subject: | #33463 [Opn->WFx]: Unexpected Paamayim Nekudotayim in Dynamic Static Method Call | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80961@lists.php.net to get a copy of this message | ||
ID: 33463
Updated by: tony2001@php.net
Reported By: etienne at actrix dot co dot nz
-Status: Open
+Status: Wont fix
Bug Type: Class/Object related
Operating System: Windows XP Pro
PHP Version: 5.0.4
New Comment:
Use call_user_func() for that.
Previous Comments:
------------------------------------------------------------------------
[2005-06-24 12:26:42] etienne at actrix dot co dot nz
Description:
------------
Basically, a call to a static class method produces a parse error.
Unexpected Paamayim Nekudotayim (::).
This sort of coding works on normal method calls, and object
instantiation.
For example, the following works fine:
$name = "ClassName";
$instance = new $name();
^^ will create a new instance of ClassName;
or
public function method() {
//some code
}
$methodName = "method";
$methodName();
^^ will run method().
Reproduce code:
---------------
class ClassName {
public static function staticClassMethod() {
//some code
}
}
$name = "ClassName";
$name::staticClassMethod();
Expected result:
----------------
I expected php to call the method "staticClassMethod".
Actual result:
--------------
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33463&edit=1