From: Roland Häder Date: Mon, 9 Sep 2024 18:49:23 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=72e92f09fa7cce44e9636af3e08de92814a31db6;p=mailer.git Continued: - added missing type-hints - fixed new PHP error about passing NULL to trim() function --- diff --git a/inc/session-functions.php b/inc/session-functions.php index e1dff3de40..11186f21b1 100644 --- a/inc/session-functions.php +++ b/inc/session-functions.php @@ -36,7 +36,7 @@ if (!defined('__SECURITY')) { } // END - if // Unset/set session variables -function setSession ($var, $value) { +function setSession (string $var, $value) { // Abort in CSS mode here if (isCssOutputMode()) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Is CSS mode:' . $var . '=' . $value); @@ -44,10 +44,10 @@ function setSession ($var, $value) { } // END - if // Trim value and session variable - $var = trim(secureString($var)); + $var = trim(secureString($var)); // Is the value no array? - if (!is_array($value)) { + if (!is_array($value) && !is_null($value)) { // Then trim it $value = trim($value); } // END - if @@ -88,13 +88,13 @@ function setSession ($var, $value) { } // Check whether a session variable is set -function isSessionVariableSet ($var) { +function isSessionVariableSet (string $var) { // Warning: DO NOT call logDebugMessage() from here, this will cause an endless loop return (isset($_SESSION[$var])); } // Returns whether the value of the session variable or NULL if not set -function getSession ($var) { +function getSession (string $var) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'var=' . $var . ' - CALLED!'); // Default is not found ;-) $value = NULL; @@ -123,7 +123,7 @@ function getSessionArray () { } // Destroy user session -function destroyMemberSession ($destroy = FALSE) { +function destroyMemberSession (bool $destroy = FALSE) { // Reset userid initMemberId(); @@ -137,7 +137,7 @@ function destroyMemberSession ($destroy = FALSE) { } // Destroys the admin session -function destroyAdminSession ($destroy = FALSE) { +function destroyAdminSession (bool $destroy = FALSE) { // Kill maybe existing session variables including array elements setAdminId(0); setAdminMd5(''); @@ -177,7 +177,7 @@ function isValidSession () { } // Checks whether all given session data is set -function isSessionDataSet ($sessionData) { +function isSessionDataSet (array $sessionData) { // Default is set $isset = TRUE; @@ -218,4 +218,3 @@ function initSession () { } // [EOF] -?>