#30716 [NEW]: Dynamic Static Member Access

From: Date: Mon, 08 Nov 2004 04:59:16 +0000
Subject: #30716 [NEW]: Dynamic Static Member Access
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-68793@lists.php.net to get a copy of this message
From: jake at development dot mindvision dot com dot au Operating system: Gentoo Linux (2.4.x) PHP version: 5.0.1 PHP Bug Type: Scripting Engine problem Bug description: Dynamic Static Member Access Description: ------------ Hello, I feel i have a syntax bug or unclear syntax limitation. I am trying to access static members of classes, dynamically ie $foo = 'className'; echo $foo::$staticVariable; For more information please see my posts on the php-generals list - http://news.php.net/php.general/201458 Thanks in advance Yours Sincerely Jake Press Reproduce code: --------------- <?php // Define a class with a nice juicy static variable class bob { public static $type = 'safd'; } // Lets chuck the name of the class into a variable... $foo = 'bob'; // Just to show it all works lets do it manualllllly echo bob::$type; // This is the line with the well-wicked parse error on the double colon echo $foo::$type; ?> Expected result: ---------------- safdsafd Actual result: -------------- Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in /mnt/data0/www/twd/test.php on line 15 -- Edit bug report at http://bugs.php.net/?id=30716&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30716&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30716&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30716&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30716&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30716&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30716&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30716&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30716&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30716&r=support Expected behavior: http://bugs.php.net/fix.php?id=30716&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30716&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30716&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30716&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30716&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30716&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30716&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30716&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30716&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30716&r=mysqlcfg

« previous php.bugs (#68793) next »