#44642 [WFx]: Trouble with scope resolution operator being used twice

From: Date: Sat, 05 Apr 2008 17:59:47 +0000
Subject: #44642 [WFx]: Trouble with scope resolution operator being used twice
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-123990@lists.php.net to get a copy of this message
ID: 44642 User updated by: bsgreenb at gmail dot com Reported By: bsgreenb at gmail dot com Status: Wont fix Bug Type: Class/Object related Operating System: Windows XP PHP Version: 5.3CVS-2008-04-04 (CVS) New Comment: I mean, yes, it can be done that way, but shouldn't we have the option of doing it this way? There are plenty of "unreadable" ways of writing PHP code that follow from the internal logic of the language. If 5.3 guarantees the ability to call static with variables, it would seem only reasonable to assume that this can be done with two variables. Previous Comments: ------------------------------------------------------------------------ [2008-04-05 12:29:50] colder@php.net No need to make the language accepts such unreadable code... what about $name = A::$b; $name::d(); ? ------------------------------------------------------------------------ [2008-04-04 22:18:34] bsgreenb at gmail dot com Description: ------------ The problem is that a::$b::d() causes error, where a is a class with static variable $b, which points to a seperate class c, which has the static function d. I know other people have encountered this problem. One person told me the only way they knew to deal with this was call_user_func() this seems like something that would be very important to fix. it is for me, at least. Reproduce code: --------------- <?php //Tested on PHP 5.3, Class a { public static $b ='c'; } Class c { public static function d() { return 'this works'; } } a::$b; // 'c' c::d(); // 'this works' a::$b::d(); /* this crashes with the following error: Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testobj.php on line 17 */ ?> Expected result: ---------------- I expected that a::$b::d() would return 'this works', as opposed to throwing an error at me. Actual result: -------------- Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testobj.php on line 17 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44642&edit=1

« previous php.bugs (#123990) next »