[BUGFIX] Fix notices in UserAuthentication 66/54666/4
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Thu, 16 Nov 2017 14:38:23 +0000 (15:38 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 17 Nov 2017 07:43:37 +0000 (08:43 +0100)
Resolves: #83003
Releases: master, 8.7
Change-Id: Iceaa7ab9bd436322229e591677c0aee16cd69f5c
Reviewed-on: https://review.typo3.org/54666
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php

index e20219e..3b9b341 100644 (file)
@@ -650,15 +650,15 @@ abstract class AbstractUserAuthentication
             } else {
                 GeneralUtility::devLog('No user session found.', self::class, 2);
             }
-            if (is_array($this->svConfig['setup'])) {
+            if (is_array($this->svConfig['setup'] ?? false)) {
                 GeneralUtility::devLog('SV setup: ' . GeneralUtility::arrayToLogString($this->svConfig['setup']), self::class, 0);
             }
         }
 
         // Fetch user if ...
         if (
-            $activeLogin || $this->svConfig['setup'][$this->loginType . '_alwaysFetchUser']
-            || !$haveSession && $this->svConfig['setup'][$this->loginType . '_fetchUserIfNoSession']
+            $activeLogin || !empty($this->svConfig['setup'][$this->loginType . '_alwaysFetchUser'])
+            || !$haveSession && !empty($this->svConfig['setup'][$this->loginType . '_fetchUserIfNoSession'])
         ) {
             // Use 'auth' service to find the user
             // First found user will be used
@@ -699,7 +699,7 @@ abstract class AbstractUserAuthentication
             }
         }
         // Re-auth user when 'auth'-service option is set
-        if ($this->svConfig['setup'][$this->loginType . '_alwaysAuthUser']) {
+        if (!empty($this->svConfig['setup'][$this->loginType . '_alwaysAuthUser'])) {
             $authenticated = false;
             if ($this->writeDevLog) {
                 GeneralUtility::devLog('alwaysAuthUser option is enabled', self::class);
@@ -969,7 +969,7 @@ abstract class AbstractUserAuthentication
 
         $this->sessionData = unserialize($sessionRecord['ses_data']);
         // Session is anonymous so no need to fetch user
-        if ($sessionRecord['ses_anonymous']) {
+        if (!empty($sessionRecord['ses_anonymous'])) {
             return $sessionRecord;
         }
 
index 04ff453..6cd69fb 100644 (file)
@@ -1173,12 +1173,12 @@ class BackendUserAuthentication extends AbstractUserAuthentication
         if ($key !== '') {
             if (count($parts) > 1 && $parts[1] !== '') {
                 // Go on, get the next level
-                if (is_array($config[$key . '.'])) {
+                if (is_array($config[$key . '.'] ?? false)) {
                     $TSConf = $this->getTSConfig($parts[1], $config[$key . '.']);
                 }
             } else {
-                $TSConf['value'] = $config[$key];
-                $TSConf['properties'] = $config[$key . '.'];
+                $TSConf['value'] = $config[$key] ?? null;
+                $TSConf['properties'] = $config[$key . '.'] ?? null;
             }
         }
         return $TSConf;
@@ -2025,7 +2025,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
      */
     protected function initializeDbMountpointsInWorkspace()
     {
-        $dbMountpoints = trim($this->workspaceRec['db_mountpoints']);
+        $dbMountpoints = trim($this->workspaceRec['db_mountpoints'] ?? '');
         if ($this->workspace > 0 && $dbMountpoints != '') {
             $filteredDbMountpoints = [];
             // Notice: We cannot call $this->getPagePermsClause(1);