[BUGFIX] Fix notices in UserAuthentication 52/54652/3
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Wed, 15 Nov 2017 14:20:07 +0000 (15:20 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 16 Nov 2017 14:37:13 +0000 (15:37 +0100)
Resolves: #83003
Releases: master, 8.7
Change-Id: Iceaa7ab9bd436322229e591677c0aee16cd69f5c
Reviewed-on: https://review.typo3.org/54652
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
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 062807d..40e9fcb 100644 (file)
@@ -627,14 +627,14 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
         } else {
             $this->logger->debug('No user session found');
         }
-        if (is_array($this->svConfig['setup'])) {
+        if (is_array($this->svConfig['setup'] ?? false)) {
             $this->logger->debug('SV setup', $this->svConfig['setup']);
         }
 
         // 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
@@ -675,7 +675,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
             ]);
         }
         // 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;
             $this->logger->debug('alwaysAuthUser option is enabled');
         }
@@ -952,7 +952,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
 
         $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 d1810f0..01f693b 100644 (file)
@@ -1208,12 +1208,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;
@@ -2060,7 +2060,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);