Bug #13138 Updated: constants behave weird in static hash arrays
ID: 13138
Updated by: joey
Reported By: jack@mobil.cz
Old Status: Feedback
Status: Closed
Bug Type: Scripting Engine problem
Operating System: linux
PHP Version: 4.0.4pl1
New Comment:
Great. If you still have problems, please reopen.
Previous Comments:
------------------------------------------------------------------------
[2001-09-04 16:51:52] joey@php.net
Please try a more recent version of PHP. 4.0.7RC1 gives
me:
array(1) {
[1]=>
bool(true)
}
array(1) {
[1]=>
bool(true)
}
------------------------------------------------------------------------
[2001-09-04 13:23:25] jack@mobil.cz
I think the following piece of code behaves sort of weird:
<?
define ('A', 1);
function test()
{
$a = array(1 => true);
static $stat_a = array(A => true);
var_dump($a);
var_dump($stat_a);
}
test();
?>
result is:
array(1) {
[1]=>
bool(true)
}
array(1) {
["A"]=>
bool(true)
}
I'm not sure whether static variables are supposed to evaluate expressions but even if they
were not, the engine should at least issue a warning.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13138&edit=1
Thread (4 messages)