Bug #13138: constants behave weird in static hash arrays

From: Date: Tue, 04 Sep 2001 17:23:26 +0000
Subject: Bug #13138: constants behave weird in static hash arrays
Groups: php.dev 
Request: Send a blank email to php-dev+get-65071@lists.php.net to get a copy of this message
From:             jack@mobil.cz
Operating system: linux
PHP version:      4.0.4pl1
PHP Bug Type:     Scripting Engine problem
Bug description:  constants behave weird in static hash arrays

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 bug report at: http://bugs.php.net/?id=13138&edit=1



Thread (4 messages)

« previous php.dev (#65071) next »