|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19073 isset returning false positives
Submitted: 2002-08-23 11:19 UTC Modified: 2002-08-23 11:20 UTC
From: tim at thelogichouse dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.2.2 OS: Red Hat Linux 7.2
Private report: No CVE-ID: None
 [2002-08-23 11:19 UTC] tim at thelogichouse dot com
 $x = "";

 if (isset($x))
    print "X is set\n";

 if (isset($y));
    print "Y is set\n";

 if (strlen($x) > 0)
    print "X is set (SL)\n";

 if (strlen($y) > 0)
    print "Y is set (SL)\n";

The following script should at best print 'X is Set' because $x has been set to "". However This is my output:

X is set
Y is set

$y is nowhere defined in the script, yet isset returns it as set.

Please feel free to contact if you need any more info.

Timothy M. Crider


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-23 11:20 UTC] tim at thelogichouse dot com
The script was written incorrectly.
 [2002-09-23 22:36 UTC] geethanandh at yahoo dot com
 Tis is not a bug, u had placed a semi-colon after the if staement, so print is not includeed in the if condition cheking, so it priints Y is set.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 04 12:01:27 2023 UTC