php - $_SESSION unset issue -


i have bizzare case session variable being unset. seems being caused following line:

if($_server['script_name'] != "/search.php") unset($_session["search"]); 

whereas if remove unset() in if clause works fine. curious thing echo arbitrary text in place of unset(), nothing comes out (indicating fine).

can see possible issues above line might cause $_session still unset, bearing in mind $_session['search'] array (and multidimensional)??

edit:

include server_root.'/classes/session.class.php'; $sess = new session(); session_start(); 

for example following echo out 'hallelujah':

if($_server['script_name'] != "/search.php") ; if(isset($_session["search"])) echo 'hallelujah'; 

but not (and if statement evaluates false):

if($_server['script_name'] != "/search.php") unset($_session["search"]); if(isset($_session["search"])) echo 'hallelujah'; 

if($_server['script_name'] != "/search.php") unset($_session["search"]); if(isset($_session["search"])) echo 'hallelujah'; 

if first condition true, unsets 'search'. means second condition won't fire, why aren't echoing anything. seems problem here?

edit

added more debug after comment

var_dump($_server['script_name'] != "/search.php") 

what's printed when put this? true or false?


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -