[BUGFIX] Fix PHP warnings on fe_user log out 62/27362/4
authorMarkus Klein <klein.t3@mfc-linz.at>
Wed, 5 Feb 2014 16:21:16 +0000 (17:21 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 3 Mar 2014 18:59:32 +0000 (19:59 +0100)
PHP Warning: Illegal string offset is thrown in some places
if an fe_user logs out.

Resolves: #55696
Releases: 6.2
Change-Id: I532a27c0d2fc4b80d3a3f92da0079f4e9517d06c
Reviewed-on: https://review.typo3.org/27362
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Oliver Klee
Reviewed-by: Alexander Opitz
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php
typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 05bb2a3..7b4ed81 100644 (file)
@@ -1175,14 +1175,15 @@ abstract class AbstractUserAuthentication {
        }
 
        /**
-        * Sets $theUC as the internal variable ->uc IF $theUC is an array. If $theUC is FALSE, the 'uc' content from the ->user array will be unserialized and restored in ->uc
+        * Sets $theUC as the internal variable ->uc IF $theUC is an array.
+        * If $theUC is FALSE, the 'uc' content from the ->user array will be unserialized and restored in ->uc
         *
         * @param mixed $theUC If an array, then set as ->uc, otherwise load from user record
         * @return void
         * @todo Define visibility
         */
        public function unpack_uc($theUC = '') {
-               if (!$theUC) {
+               if (!$theUC && isset($this->user['uc'])) {
                        $theUC = unserialize($this->user['uc']);
                }
                if (is_array($theUC)) {
index a6b843b..eb8dae3 100644 (file)
@@ -194,8 +194,8 @@ class FrontendUserAuthentication extends \TYPO3\CMS\Core\Authentication\Abstract
         * @todo Define visibility
         */
        public function isSetSessionCookie() {
-               $retVal = ($this->newSessionID || $this->forceSetCookie) && ($this->lifetime == 0 || !$this->user['ses_permanent']);
-               return $retVal;
+               return ($this->newSessionID || $this->forceSetCookie)
+                       && ($this->lifetime == 0 || !isset($this->user['ses_permanent']) || !$this->user['ses_permanent']);
        }
 
        /**
@@ -206,7 +206,7 @@ class FrontendUserAuthentication extends \TYPO3\CMS\Core\Authentication\Abstract
         * @todo Define visibility
         */
        public function isRefreshTimeBasedCookie() {
-               return $this->lifetime > 0 && $this->user['ses_permanent'];
+               return $this->lifetime > 0 && isset($this->user['ses_permanent']) && $this->user['ses_permanent'];
        }
 
        /**
index 8f72e97..4be87dc 100644 (file)
@@ -3761,7 +3761,7 @@ if (version == "n3") {
                $search = array();
                $replace = array();
                // Substitutes username mark with the username
-               if ($this->fe_user->user['uid']) {
+               if (!empty($this->fe_user->user['uid'])) {
                        // User name:
                        $token = isset($this->config['config']['USERNAME_substToken']) ? trim($this->config['config']['USERNAME_substToken']) : '';
                        $search[] = $token ? $token : '<!--###USERNAME###-->';