PHP 4.0 Bug #8141 Updated: "define" as array index in class definition is ignored
| From: | stas@php.net | Date: | Thu, 07 Dec 2000 10:45:58 +0000 |
| Subject: | PHP 4.0 Bug #8141 Updated: "define" as array index in class definition is ignored | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-40350@lists.php.net to get a copy of this message | ||
ID: 8141
Updated by: stas
Reported By: hp@oeri.ch
Status: Closed
Bug Type: Class/Object related
Assigned To:
Comments:
OK, I've fixed in CVS so that it doesn't do any stupid
things, but define() still won't work. What would happen is
exactly as if there was no define() - i.e., you get array
with key "ABC". That's the best that can be done now.
Previous Comments:
---------------------------------------------------------------------------
[2000-12-07 03:54:10] stas@php.net
Actually, it is a bug. It doesn't give any error, produces
undesired behaviour and leaks memory. This should be fixed
either way - or give warning/error, or work - and in either
case not to leak.
---------------------------------------------------------------------------
[2000-12-06 17:31:22] torben@php.net
Not a bug. Class variable initializers must be static; do this
in the constructor instead.
Check out the text in the manual right after the first example
on the Classes page:
http://www.php.net/manual/language.oop.php
Hope this helps,
Torben
---------------------------------------------------------------------------
[2000-12-06 16:36:07] hp@oeri.ch
In the snippet below, the array entry "ABC"=>1 is simply ignored. An array
OUTSIDE of a class definition is fine!
<?
define( "ABC", 8 );
class test {
var $t = array( ABC => 1, 2 => 3 );
}
$u = New test();
var_dump( $u );
?>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8141