#34419 [NEW]: array_key_exists warns for large numeric keys

From: Date: Thu, 08 Sep 2005 04:05:14 +0000
Subject: #34419 [NEW]: array_key_exists warns for large numeric keys
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84669@lists.php.net to get a copy of this message
From: bsdson dot tw at yahoo dot com dot tw Operating system: Linux PHP version: 5.0.5 PHP Bug Type: Arrays related Bug description: array_key_exists warns for large numeric keys Description: ------------ The same issue as Bug#21954, that 'array_key_exists' warns for large numeric keys! Bug#21954 is believed to be bogus, but I don't think so! From the manual of this function, it says that "key can be any value possible for an array index". Since the statement '$a[2163195907] = "hi";' is acceptable for PHP, the function should accept 2163195907 as the argument 'key', too. More, PHP is used as a type-less language, why should I bother from that?! Reproduce code: --------------- <?php $a = array(); $a[2163195907] = "hi"; echo array_key_exists(2163195907,$a); ?> Expected result: ---------------- true Actual result: -------------- Warning: array_key_exists(): The first argument should be either a string or an integer in bug.php on line 4 -- Edit bug report at http://bugs.php.net/?id=34419&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34419&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34419&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34419&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34419&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34419&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34419&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34419&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34419&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34419&r=support Expected behavior: http://bugs.php.net/fix.php?id=34419&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34419&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34419&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34419&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34419&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34419&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34419&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34419&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34419&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34419&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34419&r=mysqlcfg

« previous php.bugs (#84669) next »