#31813 [Csd->Bgs]: Bogus empty()

From: Date: Wed, 02 Feb 2005 13:47:09 +0000
Subject: #31813 [Csd->Bgs]: Bogus empty()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73268@lists.php.net to get a copy of this message
ID: 31813 Updated by: johannes@php.net Reported By: stach at chello dot pl -Status: Closed +Status: Bogus Bug Type: Arrays related Operating System: win32 (2000srv) PHP Version: 4.3.10 Previous Comments: ------------------------------------------------------------------------ [2005-02-02 14:42:07] stach at chello dot pl I've found the explanation that empty() should work like this (however pre 4.3.10 empty in case like that would return false as I would expect). 0 in a string is not an empty value, and in my opinion empty should return false in case like this. But thats my thinkin :) ------------------------------------------------------------------------ [2005-02-02 14:39:40] tony2001@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php "empty() returns FALSE if var has a non-empty and non-zero value." http://php.net/empty ------------------------------------------------------------------------ [2005-02-02 14:28:18] stach at chello dot pl Description: ------------ function empty returns true when the value of the variable is '0' (string). Reproduce code: --------------- $d['id'][0] = '0'; var_dump(empty($d['id'][0])); Expected result: ---------------- false Actual result: -------------- true ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31813&edit=1

« previous php.bugs (#73268) next »