|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-02-24 18:21 UTC] 11honza11 at seznam dot cz
Description: ------------ There is no support for DIRECT access constants, static properties or static methods from static context. It means, that there is only "one-level" ability to access theese things. We have to use workaround to eliminate this problem. But this workaround rises up a code and seems strange. Test script: --------------- echo config::$languageFile::error404; Expected result: ---------------- The page was not found Actual result: -------------- Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' ----------------------- The workaround is: $languageFile = config::$languageFile; echo $languageFile::error404; The code above works. The direct access would be purer and easier. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 22:00:01 2025 UTC |
The test script given could be a bit more complete. A complete version would be: <?php class Foo { static public $bar = "Bar"; } class Bar { static public $baz = "Baz"; } echo Foo::$bar::$baz; ?> where I would expect an output of "Baz" instead of the given syntax error.