#28404 [NEW]: float array keys equal to zero for isset() and empty()
| From: | info at silisoftware dot com | Date: | Fri, 14 May 2004 18:55:55 +0000 |
| Subject: | #28404 [NEW]: float array keys equal to zero for isset() and empty() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-59642@lists.php.net to get a copy of this message | ||
From: info at silisoftware dot com
Operating system: WinXP
PHP version: 5.0.0RC2
PHP Bug Type: Arrays related
Bug description: float array keys equal to zero for isset() and empty()
Description:
------------
When testing arrays for a key's existance with isset() or empty(), a float
key is treated as zero in PHP v5. This behavior differs from PHP v4.3.6.
Reproduce code:
---------------
$MyArray[0] = 'zero';
$key = (float) 5;
$isset = isset($MyArray[$key]);
var_dump($isset);
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
--
Edit bug report at http://bugs.php.net/?id=28404&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28404&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28404&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28404&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28404&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28404&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28404&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28404&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28404&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28404&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28404&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28404&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28404&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28404&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28404&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28404&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28404&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28404&r=float