PDA

View Full Version : isset and $_SESSION bug?


rabbitism
08-12-2009, 02:43 PM
Problem: The function isset is returning false on a $_SESSION variable that is set.

Two simple test files:

1) sessionstart.php

<?php
session_start();

$_SESSION['timeout'] = 88888888;

?>

2) sessiontest.php

<?php
session_start();

resin_var_dump($_SESSION);

if (isset($_SESSION['timeout'])) {
echo 'session timeout is set!';
} else {
echo 'session timeout is not set!';
}

?>


In the above, I hit the sessionstart.php, and then hit sessiontest.php in the browser manually. I always get 'session timeout is not set'.

The resin_dump_var of $_SESSION returns:

array(1) {
["timeout"]=>
int(88888888)
}

Why would isset function return false? Is this a bug?

rabbitism
08-15-2009, 05:05 PM
I just figured this out.

In order for the function isset to return true, the $_SESSION variable must be assign any value.

I think this is a Quercus implementation bug for the isset function.

In my sessiontest.php file:

/* set a bogus session variable and isset will return true */
$_SESSION['bogus'] = 12627;


if (isset($_SESSION['timeout'])) {
echo 'session timeout is set!';
} else {
echo 'session timeout is not set!';
}

nam
08-17-2009, 06:42 PM
Thanks for bringing this to our attention. I've filed a bug report at:

http://bugs.caucho.com/view.php?id=3636

-- Nam

nam
08-27-2009, 06:36 PM
Fixed for 4.0.2

tazzydemon
11-11-2009, 09:53 AM
Dear All
I also have the isset $_SESSION bug when attempting to get Modx running with quercus.

Loggin into the manager gives two problems on of which is this

In accesscontrol.inc.php L57 this test fails:

if(!isset($_SESSION['mgrValidated'])){

Printing the result of the test and the value of the session variable show that the variable is 1 and yet the test as far as I can tell does not return 1 or 0 but nothing at all. Null.

Changing the test to this works but of course will fail with a fresh session.

if(!$_SESSION['mgrValidated']>0){

We need isset working!!

nam
11-12-2009, 06:26 PM
This is fixed for the upcoming 4.0.2 release.