php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13073 empty() returns wrong value
Submitted: 2001-08-31 04:19 UTC Modified: 2001-08-31 14:31 UTC
From: carsten dot senf at novasib dot de Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.0.6 OS: Linux, Windows2000
Private report: No CVE-ID: None
 [2001-08-31 04:19 UTC] carsten dot senf at novasib dot de
Hi,

the value of iid comes from the URL-request-string. I.e. &iid=0
If I test of the emptyness of $iid, empty($iid) returns FALSE, but $iid is not empty.

if (empty($iid)) {
$iid = '5.1';
}

The test "if ($iid == '') returns the right value.

regards,
Carsten

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-31 06:31 UTC] cynic@php.net
I suggest you turn your attention to the PHP manual.
(Though I admit that the fact that empty() returns true for 0 and "0" could be stresse more in the manual page.)
 [2001-08-31 14:31 UTC] jeroen@php.net
"empty($iid) returns FALSE, but $iid is not empty."

$iid is NOT empty, so it indeed returns false... :-)


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 13:01:30 2024 UTC