php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23097 isset() function returns nothing
Submitted: 2003-04-07 12:12 UTC Modified: 2003-04-07 14:00 UTC
From: alex at globaldesign dot ca Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.0 OS: Win XP
Private report: No CVE-ID: None
 [2003-04-07 12:12 UTC] alex at globaldesign dot ca
The isset() function is not working properly with SESSION vars. 

The following code :

<? 
  session_start();
  echo isset($_SESSION["not_created_var"]);
?>

//Should return '0' Agreed ???

In my case it's returning nothing...
I event tried it on my web-hosting server, that is supposed to be properly configured, and still I don't get a '0'.

I read Bug #5760 answered by Derick telling that PHP4 returns ""(the empty string) if a var is not set or create, and that '0' is returned if it existed. How come I get a '1' instead ???

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-07 14:00 UTC] pollita@php.net
isset() returns one of two possible values 'true' or 'false'.  Neither of these are quantities which can be clearly displayed by echo so PHP's loose type juggling turns 'false' into a blank string and 'true' into the number 1.  (Who knows what Derick was thinking in Bug5760)

Try: var_dump(isset($_SESSION["not_created_var"])); and you'll see more meaningful information.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 09:01:31 2024 UTC