From e995a896255f853ea731a602a6f4902878f16980 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 2 Mar 2010 15:24:06 +0000 Subject: [PATCH 1/1] session_(un)register are deprecated as of 5.3.1 --- inc/libs/security_functions.php | 2 +- inc/session-functions.php | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/inc/libs/security_functions.php b/inc/libs/security_functions.php index da415b965f..7309965b5b 100644 --- a/inc/libs/security_functions.php +++ b/inc/libs/security_functions.php @@ -41,7 +41,7 @@ if (defined('__SECURITY')) return; // Some security stuff... -if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) { +if (strpos($_SERVER['PHP_SELF'], basename(__FILE__)) !== false) { die(); } // END - if diff --git a/inc/session-functions.php b/inc/session-functions.php index 8f1669f5a3..735f634194 100644 --- a/inc/session-functions.php +++ b/inc/session-functions.php @@ -55,12 +55,24 @@ function setSession ($var, $value) { // Remove the session //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UNSET:' . $var . '=' . getSession($var)); unset($GLOBALS['_SESSION'][$var]); - return session_unregister($var); + if (phpversion() >= '5.3.1') { + // session_unregister() is deprecated as of 5.3.1 + return true; + } else { + // PHP version < 5.3.1 + return session_unregister($var); + } } elseif (('' . $value . '' != '') && (!isSessionVariableSet($var))) { // Set session //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SET:' . $var . '=' . $value); $GLOBALS['_SESSION'][$var] = $value; - return session_register($var); + if (phpversion() >= '5.3.1') { + // session_unregister() is deprecated as of 5.3.1 + return true; + } else { + // PHP version < 5.3.1 + return session_register($var); + } } elseif (!empty($value)) { // Update session //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UPDATE:' . $var . '=' . $value); -- 2.39.2