#45210 [NEW]: Support for (static) property initilialization is limited

From: Date: Sun, 08 Jun 2008 21:43:52 +0000
Subject: #45210 [NEW]: Support for (static) property initilialization is limited
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-874@lists.php.net to get a copy of this message
From: jaap dot taal at gmail dot com Operating system: Windows PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Support for (static) property initilialization is limited Description: ------------ Somehow initializing properties has it's limitations. I think my example should have worked just fine (it would've worked in Java C# and a lot of other language). However, the limitation is there, but I can't find it in the documentation! I think it should be under both Classes and Objects (PHP 4) and Classes and Objects (PHP 5). Reproduce code: --------------- <?php class TestClass { public static function somefunc() { return 'somevalue'; } public static $someProperty = TestClass::somefunc(); // PARSE ERROR protected static $singleton = new TestClass(); // PARSE ERROR public $someVar = new TestClass(); // PARSE ERROR } Expected result: ---------------- No errors or limitations documented. Actual result: -------------- Parse error: syntax error, unexpected '(', expecting ',' or ';' in D:\www\binding\test.php on line 6 Parse error: syntax error, unexpected T_NEW in D:\www\binding\test.php on line 7 Parse error: syntax error, unexpected T_NEW in D:\www\binding\test.php on line 8 -- Edit bug report at http://bugs.php.net/?id=45210&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45210&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45210&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45210&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45210&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45210&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45210&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45210&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45210&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45210&r=support Expected behavior: http://bugs.php.net/fix.php?id=45210&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45210&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45210&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45210&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45210&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45210&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45210&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45210&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45210&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45210&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45210&r=mysqlcfg

« previous php.doc.bugs (#874) next »