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

From: Date: Sat, 05 Apr 2008 12:29:51 +0000
Subject: #44642 [Opn->WFx]: Trouble with scope resolution operator being used twice
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-123985@lists.php.net to get a copy of this message
ID: 44642 Updated by: colder@php.net Reported By: bsgreenb at gmail dot com -Status: Open +Status: Wont fix Bug Type: Class/Object related Operating System: Windows XP PHP Version: 5.3CVS-2008-04-04 (CVS) New Comment: No need to make the language accepts such unreadable code... what about $name = A::$b; $name::d(); ? Previous Comments: ------------------------------------------------------------------------ [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 (#123985) next »