Bug #15513 Updated: Session Not Saved if header(Location... used

From: Date: Tue, 12 Feb 2002 13:41:10 +0000
Subject: Bug #15513 Updated: Session Not Saved if header(Location... used
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-179@lists.php.net to get a copy of this message
ID: 15513 Updated by: dante.lorenso@atmosenergy.com Reported By: dante.lorenso@atmosenergy.com -Status: Open +Status: Closed Bug Type: Session related Operating System: Windows 98 and RedHat Linux 7.2 PHP Version: 4.1.1 New Comment: Yeah, whatever. I'm an idiot. Everything is fine here. Just ignore me. --dante Previous Comments: ------------------------------------------------------------------------ [2002-02-11 19:20:43] dante.lorenso@atmosenergy.com 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 this bug report at http://bugs.php.net/?id=15513&edit=1

« previous php.bugs (#179) next »