2004-01-06 06:17:14 +08:00
|
|
|
--TEST--
|
2004-01-06 06:45:11 +08:00
|
|
|
Bug #26802 (Can't call static method using a variable)
|
2004-01-06 06:17:14 +08:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2004-01-06 08:51:43 +08:00
|
|
|
|
2004-02-11 18:48:20 +08:00
|
|
|
function global_func()
|
|
|
|
{
|
2004-01-06 08:51:43 +08:00
|
|
|
echo __METHOD__ . "\n";
|
|
|
|
}
|
|
|
|
|
2004-02-11 18:48:20 +08:00
|
|
|
$function = 'global_func';
|
2004-01-06 08:51:43 +08:00
|
|
|
$function();
|
|
|
|
|
2004-01-06 06:17:14 +08:00
|
|
|
class foo
|
|
|
|
{
|
2004-02-11 18:48:20 +08:00
|
|
|
static $method = 'global_func';
|
2004-01-06 08:51:43 +08:00
|
|
|
|
2004-02-11 18:48:20 +08:00
|
|
|
static public function foo_func()
|
|
|
|
{
|
2004-01-06 08:51:43 +08:00
|
|
|
echo __METHOD__ . "\n";
|
2004-01-06 06:17:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-17 21:00:38 +08:00
|
|
|
/* The following is a BC break with PHP 4 where it would
|
|
|
|
* call foo::fail. In PHP 5 we first evaluate static class
|
2004-01-06 08:51:43 +08:00
|
|
|
* properties and then do the function call.
|
|
|
|
*/
|
2004-02-11 18:48:20 +08:00
|
|
|
$method = 'foo_func';
|
2004-01-06 08:51:43 +08:00
|
|
|
foo::$method();
|
2004-02-11 18:48:20 +08:00
|
|
|
|
|
|
|
|
2004-01-06 06:17:14 +08:00
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--EXPECT--
|
2004-02-11 18:48:20 +08:00
|
|
|
global_func
|
|
|
|
foo::foo_func
|
2004-01-06 06:17:14 +08:00
|
|
|
===DONE===
|