#45100 [NEW]: array_key_exists() doesn't accept the same key as real array
| From: | atom at atomsoft dot cz | Date: | Tue, 27 May 2008 04:36:02 +0000 |
| Subject: | #45100 [NEW]: array_key_exists() doesn't accept the same key as real array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-125287@lists.php.net to get a copy of this message | ||
From: atom at atomsoft dot cz
Operating system: Windows XP
PHP version: 5.2.6
PHP Bug Type: *General Issues
Bug description: array_key_exists() doesn't accept the same key as real array
Description:
------------
floor() return double type, but in documentation is floor.
This is first bug. But for it exist another bug report.
Second problem is array_key_exists() it hasn't accepted by
array_key_exists, but $a[$key] = 'value' is OK. I think, that PHP accept
double a key index, array_key_exists should be accept it too.
Reproduce code:
---------------
$key = floor(1/10);
$a = array();
$a[$key] = 'value';
echo $a[$key] . "\n";
echo array_key_exists($key, $a)? "YES\n" : "NO\n";
echo gettype($key) . "\n";
Expected result:
----------------
value
YES
float (according documentation)
Actual result:
--------------
value
Warning: array_key_exists() function.array-key-exists: The first argument
should be either a string or an integer in ...
NO
double
--
Edit bug report at http://bugs.php.net/?id=45100&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45100&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45100&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45100&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45100&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45100&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45100&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45100&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45100&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45100&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45100&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45100&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45100&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45100&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45100&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45100&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45100&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45100&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45100&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45100&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45100&r=mysqlcfg