From: tokul Date: Mon, 18 Sep 2006 11:30:00 +0000 (+0000) Subject: Suppress SID constant notices in older PHP versions. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=66c7cd3fe4a58b3425395325cbce311520651c9b Suppress SID constant notices in older PHP versions. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11710 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/global.php b/functions/global.php index d7612d16..abb28b06 100644 --- a/functions/global.php +++ b/functions/global.php @@ -218,6 +218,13 @@ function sqgetGlobalVar($name, &$value, $search = SQ_INORDER, $default = NULL, $ /** * Deletes an existing session, more advanced than the standard PHP * session_destroy(), it explicitly deletes the cookies and global vars. + * + * WARNING: Older PHP versions have some issues with session management. + * See http://bugs.php.net/11643 (warning, spammed bug tracker) and + * http://bugs.php.net/13834. SID constant is not destroyed in PHP 4.1.2, + * 4.2.3 and maybe other versions. If you restart session after session + * is destroyed, affected PHP versions produce PHP notice. Bug should + * be fixed only in 4.3.0 */ function sqsession_destroy() { diff --git a/src/login.php b/src/login.php index 4cb1f31e..1a348617 100644 --- a/src/login.php +++ b/src/login.php @@ -35,19 +35,12 @@ set_up_language($squirrelmail_language, TRUE, TRUE); * In case the last session was not terminated properly, make sure * we get a new one, but make sure we preserve session_expired_* */ -/** - * PHP bug. http://bugs.php.net/11643 (warning, spammed bug tracker) and - * http://bugs.php.net/13834 - * SID constant is not destroyed in PHP 4.1.2, 4.2.3 and maybe other - * versions. Produces warning on login page. Bug should be fixed only in 4.3.0 - */ if ( !empty($_SESSION['session_expired_post']) && !empty($_SESSION['session_expired_location']) ) { $sep = $_SESSION['session_expired_post']; $sel = $_SESSION['session_expired_location']; sqsession_destroy(); - - sqsession_is_active(); + @sqsession_is_active(); $_SESSION=array(); sqsession_register($sep, 'session_expired_post'); sqsession_register($sel, 'session_expired_location'); diff --git a/src/redirect.php b/src/redirect.php index ce067196..de4b5f87 100644 --- a/src/redirect.php +++ b/src/redirect.php @@ -70,7 +70,7 @@ if (!sqsession_is_registered('user_is_logged_in')) { /* regenerate the session id to avoid session hyijacking */ sqsession_destroy(); - sqsession_is_active(); + @sqsession_is_active(); session_regenerate_id(); /** * The cookie part. session_start and session_regenerate_session normally set