#26802 [Csd->Opn]: Can't call function throgh static property
| From: | helly@php.net | Date: | Tue, 06 Jan 2004 00:49:39 +0000 |
| Subject: | #26802 [Csd->Opn]: Can't call function throgh static property | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52839@lists.php.net to get a copy of this message | ||
ID: 26802
Updated by: helly@php.net
-Summary: Can't call static method using a variable
Reported By: adam at trachtenberg dot com
-Status: Closed
+Status: Open
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5.0.0b3 (beta3)
New Comment:
Updated test to all different versions showed that indeed one way of
calling a class is wrong.
class::$prop() should evaluate class::$prop and call that function. But
instead it calls the method specified by the result in the class given.
In other words the class name is used twice.
Previous Comments:
------------------------------------------------------------------------
[2004-01-05 17:41:13] helly@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.
------------------------------------------------------------------------
[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