[PHP-DEV] Bug #13138 Updated: constants behave weird in static hash arrays From: joey <email protected>
Date: 09/05/01

ID: 13138
Updated by: joey
Reported By: jack <email protected>
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 <email protected>

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 <email protected>

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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>