Bug #15513: Session Not Saved if header(Location... used
| From: | dante dot lorenso at atmosenergy dot com | Date: | Tue, 12 Feb 2002 00:20:43 +0000 |
| Subject: | Bug #15513: Session Not Saved if header(Location... used | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-157@lists.php.net to get a copy of this message | ||
From: dante.lorenso@atmosenergy.com
Operating system: Windows 98 and RedHat Linux 7.2
PHP version: 4.1.1
PHP Bug Type: Session related
Bug description: Session Not Saved if header(Location... used
If I try to set or unset a session variable by
using the $_SESSION method of session handling,
before using a 'header("Location: /xyz");' redirect,
the session variable modification is not saved.
I've tried to use a 'flush()' a 'session_write_close()'
and 'exit;'...nothing seems to help.
class A {
/* CONSTRUCTOR */
function A() {
session_start();
}
/* works */
function foo() {
$_SESSION["AUTH"] = "Dante";
}
/* does NOT work */
function bar() {
$_SESSION["AUTH"] = "";
header("Location: http://www.yahoo.com/");
// flush();
// session_write_close();
// exit;
}
/* does NOT work */
function bar2() {
unset($_SESSION["AUTH"]);
header("Location: http://www.yahoo.com/");
}
}
//----------
/* file1.html
$a = new A();
$a->foo(); // works
//----------
/* file2.html
$a = new A();
$a->bar(); // fails
//----------
/* file3.html
$a = new A();
$a->bar2(); // fails
--
Edit bug report at http://bugs.php.net/?id=15513&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=15513&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=15513&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=15513&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=15513&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15513&r=support
Expected behavior: http://bugs.php.net/fix.php?id=15513&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=15513&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=15513&r=submittedtwice