php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2088 empty() not working correctly
Submitted: 1999-08-17 11:03 UTC Modified: 1999-08-17 11:07 UTC
From: musone at edgeglobal dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (17/08/1999) OS: Linux
Private report: No CVE-ID: None
 [1999-08-17 11:03 UTC] musone at edgeglobal dot com
the following produces a result of "1"

$name="0";
echo empty($name);

this should not be considered empty, from what i understand,
and it was also a fix in php3.0 a while back. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-17 11:07 UTC] andrey at cvs dot php dot net
The manual states:
"Returns false if var is set and has a non-empty or non-zero value; true otherwise. "

Since the variable has the value of 0, it is considered empty.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Feb 26 08:01:26 2020 UTC