#26869 [Ver->Csd]: (string) numeric constant as the key of static array mess up!

From: Date: Tue, 10 Feb 2004 15:24:02 +0000
Subject: #26869 [Ver->Csd]: (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-54694@lists.php.net to get a copy of this message
ID: 26869 Updated by: zeev@php.net Reported By: xuefer at 21cn dot com -Status: Verified +Status: Closed Bug Type: Zend Engine 2 problem Operating System: * PHP Version: 5CVS-2004-02-05 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2004-01-11 08:51:15] sniper@php.net 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..) ------------------------------------------------------------------------ [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

« previous php.bugs (#54694) next »