"The Plankmeister" <pl******************@hotmail.com> wrote in message news:<3f***********************@dread16.news.tele. dk>...
Hi...
I'm using session_set_save_handler() and have defined some functions to
store session data in a database. It all works marvellously. Except for one
small thing. If I do something like:
...
if(isset($_SESSION['my_variable']))
...
the system calls the sess_write function, but passes an empty string as the
session variable parameter. Is this correct? I'm getting around this by
using an if clause and returning false if it's an empty string. This seems
to work ok. But is this correct behaviour? Or is it a bug?
TIA.
Plankmeister.
This is correct behaviouir, you are checking to see if it isset,
basicaly a variable in use, it can contain nothing, example
isset($a) : false
$a = ""; // empty string, basicaly set to nothing, but set it is
isset($a) // evals to true
$a = array(); // empty array()
isset($a) // vals to tru
$a = ""; // empty string, basicaly set to nothing, but set it is
unset($a);// removes string from existance, off into nerver, never..
isset($a) // evals to false
change your if to this:
if( isset($_SESSION['my_variable'] != "" )
Mike Bradley
http://gzen.myhq.info -- free online php tools