#46476 [Opn->Bgs]: initial property value can't be different than primitive type?!!

From: Date: Tue, 04 Nov 2008 09:06:40 +0000
Subject: #46476 [Opn->Bgs]: initial property value can't be different than primitive type?!!
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130587@lists.php.net to get a copy of this message
ID: 46476 Updated by: tularis@php.net Reported By: info at netmosfera dot it -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: irrelevant PHP Version: 5.3.0alpha2 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 Please check the documentation, this is a known limitation. Previous Comments: ------------------------------------------------------------------------ [2008-11-04 08:48:29] info at netmosfera dot it Description: ------------ hello i think there is a logic problem with php's fields/properties initial values they can be only int float string boolean or null! please see the code thank you Reproduce code: --------------- class Config { private static $defaultLanguage = new Lang("en"); private static $objectsUrl = new Path("my/path/"); private static $look = new LookAndFeel("default"); } ------------------- the only way i can set initial static values is ------------------- class Config { private static $defaultLanguage; private static $objectsUrl; private static $look; public static __unbelievable_static_constructor() //!!!!!!! { self::$defaultLanguage = new Lang("en"); self::$objectsUrl = new Path("my/path/"); self::$look = new LookAndFeel("default"); } } Config::__unbelievable_static_constructor(); Actual result: -------------- unexpected NEW ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46476&edit=1

« previous php.bugs (#130587) next »