Edit report at https://bugs.php.net/bug.php?id=55247&edit=1
ID: 55247 Updated by: fel...@php.net Reported by: gehrig at teqneers dot de Summary: Parser problem with static calls using string method name Status: Open -Type: Bug +Type: Feature/Change Request Package: *General Issues Operating System: Darwin 10.8.0 PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: It isn't supposed to work, so not a bug. Changed to feature request. Previous Comments: ------------------------------------------------------------------------ [2011-07-20 05:55:26] gehrig at teqneers dot de Description: ------------ PHP allows to call instance methods using the {} syntax together with a string - such as $obj->{'my-method'} for example. This allows developers to call methods whose names are not valid PHP method names. The same does not work with static method calls. Test script: --------------- <?php class Test{ public static function __callStatic($method, $arguments) { echo $method . PHP_EOL; } public function __call($method, $arguments) { echo $method . PHP_EOL; } } $method = 'method'; $test = new Test(); $test->method(); $test->$method(); $test->{'method'}(); Test::method(); Test::$method(); Test::{'method'}(); Expected result: ---------------- method method method method method method Actual result: -------------- PHP Parse error: syntax error, unexpected '{', expecting T_STRING or T_VARIABLE or '$' in Untitled.php on line 21 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55247&edit=1