|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-01-11 04:47 UTC] 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)
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 16:00:02 2025 UTC |
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..)