From: lehel at bin dot hu Operating system: Linux 2.4.8 PHP version: 4.3.2 PHP Bug Type: Session related Bug description: $_SESSION array is having problem transmitting variables
Description: ------------ This script is for logging in a user on a page. After the query $_SESSION variables are set according to the values stored in the database, I've checked them by echoing them. But when checking the same variables in start.php they contain the pre-set values that were set at the beginning of this script. After going back to the index script, and starting all over the login procedure, the results are as expected. It seems so that the session engine does not handle multiple value changes in the script where session_start is used at the first time on the page, bcause the usage of session_start on the submitting page solves the problem. db_Exec and db_Result are simple database wrappers. Reproduce code: --------------- session_start (); include_once ("Include/Common.php"); $_SESSION["UserID"]=-1; $_SESSION["lastactive"]=time ()-4000; $dbconn=db_Connect (); $query=db_Exec ($dbconn,"SELECT * FROM users WHERE username='$_POST[UserName]' AND userpwd='$_POST[UserPwd]';"); if (db_Num_Rows ($query)==0) { nupi_error ("Jelszó, vagy felhasználónév hiba!"); } $row=db_Fetch_Row ($query); $_SESSION["UserID"]=$row["user_id"]; $_SESSION["lastactive"]=time (); header ("Location: start.php"); Expected result: ---------------- $_SESSION["UserID"] = 0 $_SESSION["lastactive"] ... actual time in start.php Actual result: -------------- $_SESSION["UserID"] = -1 $_SESSION["lastactive"] ... actual time-4000 in start.php -- Edit bug report at http://bugs.php.net/?id=24144&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24144&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24144&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24144&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24144&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24144&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24144&r=support Expected behavior: http://bugs.php.net/fix.php?id=24144&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24144&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24144&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24144&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24144&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24144&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24144&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24144&r=gnused