php-src/Zend/tests/bug26802.phpt

36 lines
556 B
Plaintext
Raw Normal View History

2004-01-05 22:17:14 +00:00
--TEST--
2004-01-05 22:45:11 +00:00
Bug #26802 (Can't call static method using a variable)
2004-01-05 22:17:14 +00:00
--FILE--
<?php
2004-01-06 00:51:43 +00:00
2004-02-11 10:48:20 +00:00
function global_func()
{
2020-02-03 21:52:20 +00:00
echo __METHOD__ . "\n";
2004-01-06 00:51:43 +00:00
}
2004-02-11 10:48:20 +00:00
$function = 'global_func';
2004-01-06 00:51:43 +00:00
$function();
2004-01-05 22:17:14 +00:00
class foo
{
2020-02-03 21:52:20 +00:00
static $method = 'global_func';
2018-09-16 17:16:42 +00:00
2020-02-03 21:52:20 +00:00
static public function foo_func()
{
echo __METHOD__ . "\n";
}
2004-01-05 22:17:14 +00:00
}
2018-10-14 16:03:31 +00: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 00:51:43 +00:00
* properties and then do the function call.
*/
2004-02-11 10:48:20 +00:00
$method = 'foo_func';
2004-01-06 00:51:43 +00:00
foo::$method();
2004-02-11 10:48:20 +00:00
2004-01-05 22:17:14 +00:00
?>
--EXPECT--
2004-02-11 10:48:20 +00:00
global_func
foo::foo_func