ID: 29377 Updated by: [EMAIL PROTECTED] Reported By: php at vladathome dot com -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: Linux PHP Version: 5.0.0 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You cannot use an expression as value of an attribute in the class definition. Previous Comments: ------------------------------------------------------------------------ [2004-07-25 17:36:56] php at vladathome dot com Description: ------------ In most (all?) other OOP-oriented languages, it's a common paradigm to define a class and provide a static member of the class in the definition and initialize it with a new object of the class. This is commonly used to implement singletons which are a must for many projects. This doesn't seem to work with PHP5. Reproduce code: --------------- <?php class Foo { static $me = new Foo(); public function __construct() { } } ?> Expected result: ---------------- Parse error: parse error, unexpected T_NEW in /u1/home/vlad/php/test/3.php on line 3 Actual result: -------------- created static member of the class with the initialized object ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29377&edit=1