From: [EMAIL PROTECTED] Operating system: Linux 2.2.19 PHP version: 4.1.2 PHP Bug Type: Session related Bug description: session variables disappear
My web host recently upgraded to PHP 4.1.2. At the same time, my user login scripts stopped working. A session variable registered with session_register() is not holding its information when the page reloads. Details: I have a file included in every page that looks like: class UserSession { var $user_id = 0; var $username = ""; var $logged_in = false; //other stuff elided } session_start(); global $user_session; if (!session_is_registered("user_session")) { session_register("user_session"); $user_session = new UserSession(); } function ProcessLogin($Username, $Password) { global $user_session; //username and password are checked against DB contents //if that's all good, get user row with mysql_fetch_array() $user_session->user_id = $row[user_id]; $user_session->username = $row[user_name]; $user_session->logged_in = true; //cookies are set and other stuff happens } When a page loads immediately after the user logs in, all is well, and the values in $user_session are all as I expect them to be. Reloading the same page, though, causes $user_session to be set back to its default values. Before the 4.1.2 upgrade, this worked fine. I've stripped the code down almost to what I show above, and it still fails, so I'm pretty sure I'm not doing anything to stomp the values later in the page. I double-checked that on the page reload, $user_session is still registered, and it appears to be. The changelog at http://www.php.net/ChangeLog-4.php only goes up to version 4.1.1, so I couldn't tell if there was any change to session variable handling in 4.1.2. Any thoughts? All suggestions are appreciated. Config line: './configure' '--with-mysql' '--with-apache=../apache_1.3.23' '--enable-track-vars' '--with-xml' '--enable-memory-limit=yes' '--enable-bcmath' '--with-gd=../gd-2.0.1' '--enable-gd-native-tt' '--enable-gd-imgstrttf' '--with-gdbm=/usr/include' '--enable-calendar' '--with-png-dir=/usr/lib' '--with-zlib-dir=/usr/include' '--with-freetype-dir=/usr/local/include/freetype2' '--with-jpeg-dir=/usr/local/lib' '--with-mcrypt' '--enable-trans-sid' '--with-sablot=/usr/local/lib' '--with-imap' '--enable-xslt' '--with-xslt-sablot' '--enable-sablot-errors-descriptive' Host info: Linux *.*.com 2.2.19-6.2.11 #1 Fri Oct 19 13:28:00 EDT 2001 i686 unknown Server is latest stable Apache. -- Edit bug report at http://bugs.php.net/?id=15822&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15822&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15822&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15822&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15822&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15822&r=support Expected behavior: http://bugs.php.net/fix.php?id=15822&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15822&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15822&r=submittedtwice