]> git.mxchange.org Git - mailer.git/blobdiff - inc/session-functions.php
Sometimes a whole array needs to be set in session (installer).
[mailer.git] / inc / session-functions.php
index 8feefa3302c17793a901c93630028fd90add42fb..dd78b81d4fbf49b94541fd0c44c29906d6daf431 100644 (file)
@@ -45,10 +45,15 @@ function setSession ($var, $value) {
 
        // Trim value and session variable
        $var   = trim(secureString($var));
-       $value = trim($value);
+
+       // Is the value no array?
+       if (!is_array($value)) {
+               // Then trim it
+               $value = trim($value);
+       } // END - if
 
        // Is the session variable set?
-       if (('' . $value . '' == '') && (isSessionVariableSet($var))) {
+       if ((!is_array($value)) && ('' . $value . '' == '') && (isSessionVariableSet($var))) {
                // Remove the session
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UNSET:' . $var . '=' . getSession($var));
                unset($_SESSION[$var]);
@@ -59,7 +64,7 @@ function setSession ($var, $value) {
                        // PHP version < 5.3.0
                        return session_unregister($var);
                }
-       } elseif (('' . $value . '' != '') && (!isSessionVariableSet($var))) {
+       } elseif ((is_array($value)) || (('' . $value . '' != '') && (!isSessionVariableSet($var)))) {
                // Set session
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SET:' . $var . '=' . $value);
                $_SESSION[$var] = $value;