#26869 [Opn->Ver]: (string) numeric constant as the key of static array mess up!
| From: | sniper@php.net | Date: | Sun, 11 Jan 2004 13:51:16 +0000 |
| Subject: | #26869 [Opn->Ver]: (string) numeric constant as the key of static array mess up! | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-53112@lists.php.net to get a copy of this message | ||
ID: 26869
Updated by: sniper@php.net
Reported By: xuefer at 21cn dot com
-Status: Open
+Status: Verified
Bug Type: Zend Engine 2 problem
-Operating System: winxp
+Operating System: *
PHP Version: 5CVS-2004-01-11 (dev)
New Comment:
Slightly better test:
# php5 -r 'define("A", "1"); static $a=array(A => 1); var_dump($a);
var_dump(isset($a[A]));'
(works fine with PHP4 btw..)
Previous Comments:
------------------------------------------------------------------------
[2004-01-11 04:47:35] xuefer at 21cn dot com
Description:
------------
defined numeric constant but in string type
used in static $a = array(A => 1);
this produce array $a with a messed up key
Reproduce code:
---------------
under cygwin:
./php5/php.exe -n -r 'define("A", "1"); static $a=array(A => 1);
var_dump($a); echo isset($a[A]); echo "\n";'
Expected result:
----------------
array(1) {
[1]=>
int(1)
}
1
Actual result:
--------------
array(1) {
["1"]=>
int(1)
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26869&edit=1