#26802 [Opn->Csd]: Can't call static method using a variable
| From: | helly@php.net | Date: | Mon, 05 Jan 2004 22:41:14 +0000 |
| Subject: | #26802 [Opn->Csd]: Can't call static method using a variable | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52831@lists.php.net to get a copy of this message | ||
ID: 26802
Updated by: helly@php.net
Reported By: adam at trachtenberg dot com
-Status: Open
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5.0.0b3 (beta3)
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:
------------------------------------------------------------------------
[2004-01-05 17:03:57] adam at trachtenberg dot com
Description:
------------
You cannot dynamically call a static methods using a
variable. This works for regular functions, for example:
function foo() {}
$f = 'foo';
$f();
Reproduce code:
---------------
class foo {
static public function bar() {
print "baz\n";
}
}
foo::bar();
$static_method = "foo::bar";
$static_method();
Expected result:
----------------
baz
baz
Actual result:
--------------
PHP Fatal error: Call to undefined function foo::bar()
in /php/test.php on line 10
baz
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26802&edit=1