#29103 [NEW]: header("location...") doesn't work after saving a session variable.

From: Date: Mon, 12 Jul 2004 02:10:40 +0000
Subject: #29103 [NEW]: header("location...") doesn't work after saving a session variable.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62076@lists.php.net to get a copy of this message
From: allenr at houston dot rr dot com Operating system: Linux PHP version: 4.3.6 PHP Bug Type: Session related Bug description: header("location...") doesn't work after saving a session variable. Description: ------------ Using Apache/1.3.29, the header("location...") feature doesn't work after saving a session variable. I have two php scripts, login and logout. In logout, I destroy the session with session_destroy() then use the redirect to get back to the starting page. This works fine. In the login script, I verify credentials then set a session variable to indicate the user is logged in, then try the exact same redirect to the index page, this doesn't work. I've tried using "Location: http://www.google.com/" which doesn't work either. I've also entered the absolute paths to the proper scripts on my own site with the same result. Reproduce code: --------------- logout.php - works ------------------ <?php if (!session_id()) session_start(); if (isset($_SESSION['loggedIn'])) session_destroy(); header("Location: index.php"); ?> login.php excerpt - broken -------------------------- if (!strcmp($row['password'], $thisPassword) && ($row ['type'] == 1)) { $_SESSION['blah'] = true; header("Location: index.php"); exit(); } Expected result: ---------------- I expect to be redirected to the page indicated in the Location header. Actual result: -------------- The system seems to ignore the header script altogether, displaying a blank screen when it hits the exit() call. -- Edit bug report at http://bugs.php.net/?id=29103&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29103&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29103&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29103&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29103&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29103&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29103&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29103&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29103&r=support Expected behavior: http://bugs.php.net/fix.php?id=29103&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29103&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29103&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29103&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29103&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29103&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29103&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29103&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29103&r=float

« previous php.bugs (#62076) next »