#28404 [Opn->Csd]: float array keys equal to zero for isset() and empty()

From: Date: Tue, 18 May 2004 00:05:25 +0000
Subject: #28404 [Opn->Csd]: float array keys equal to zero for isset() and empty()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59716@lists.php.net to get a copy of this message
ID: 28404 Updated by: pollita@php.net Reported By: info at silisoftware dot com -Status: Open +Status: Closed Bug Type: Arrays related Operating System: WinXP PHP Version: 5.0.0RC2 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-05-14 20:55:54] info at silisoftware dot com 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 this bug report at http://bugs.php.net/?id=28404&edit=1

« previous php.bugs (#59716) next »