#46476 [NEW]: initial property value can't be different than primitive type?!!
| From: | info at netmosfera dot it | Date: | Tue, 04 Nov 2008 08:48:30 +0000 |
| Subject: | #46476 [NEW]: initial property value can't be different than primitive type?!! | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-130586@lists.php.net to get a copy of this message | ||
From: info at netmosfera dot it
Operating system: irrelevant
PHP version: 5.3.0alpha2
PHP Bug Type: Class/Object related
Bug description: initial property value can't be different than primitive type?!!
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 bug report at http://bugs.php.net/?id=46476&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46476&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46476&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46476&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46476&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46476&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46476&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46476&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46476&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46476&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46476&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46476&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46476&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46476&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46476&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46476&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46476&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46476&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46476&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46476&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46476&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46476&r=mysqlcfg