diff --git a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php index 874a0a01bc64d1dc5d199ac4634a6cc8d5b0b581..bb5ed44d05334b9c37cf153d945c04a986f72a0f 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php @@ -613,8 +613,8 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface if ($haveSession) { $this->logger->debug('User session found', [ - $this->userid_column => $authInfo['userSession'][$this->userid_column], - $this->username_column => $authInfo['userSession'][$this->username_column], + $this->userid_column => $authInfo['userSession'][$this->userid_column] ?? null, + $this->username_column => $authInfo['userSession'][$this->username_column] ?? null, ]); } else { $this->logger->debug('No user session found'); @@ -639,13 +639,13 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface $this->username_column => $row[$this->username_column], ]); // User found, just stop to search for more if not configured to go on - if (!$this->svConfig['setup'][$this->loginType . '_fetchAllUsers']) { + if (empty($this->svConfig['setup'][$this->loginType . '_fetchAllUsers'])) { break; } } } - if ($this->svConfig['setup'][$this->loginType . '_alwaysFetchUser']) { + if (!empty($this->svConfig['setup'][$this->loginType . '_alwaysFetchUser'])) { $this->logger->debug($this->loginType . '_alwaysFetchUser option is enabled'); } if (empty($tempuserArr)) { diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index bf9f4c4fa78a15fbc9f758bed82c600daf04a058..8596efd1d140917bdffcb8392c666093d3d9417c 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -2676,8 +2676,8 @@ class GeneralUtility $retVal = self::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP']); break; case 'REMOTE_ADDR': - $retVal = $_SERVER['REMOTE_ADDR']; - if (self::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP'] ?? '')) { + $retVal = $_SERVER['REMOTE_ADDR'] ?? null; + if (self::cmpIP($retVal, $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP'] ?? '')) { $ip = self::trimExplode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); // Choose which IP in list to use if (!empty($ip)) { @@ -2741,9 +2741,7 @@ class GeneralUtility case 'REMOTE_HOST': case 'QUERY_STRING': - if (isset($_SERVER[$getEnvName])) { - $retVal = $_SERVER[$getEnvName]; - } + $retVal = $_SERVER[$getEnvName] ?? ''; break; case 'TYPO3_DOCUMENT_ROOT': // Get the web root (it is not the root of the TYPO3 installation) diff --git a/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php b/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php index a96b08989208f63b0bcc48ee96943380dc6021d7..e9453ee3cd0af774a19c85b09a51e223f5b498a0 100644 --- a/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php @@ -38,11 +38,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class FrontendUserAuthenticationTest extends UnitTestCase { - /** - * Subject is not notice free, disable E_NOTICES - */ - protected static $suppressNotices = true; - /** * @var array A backup of registered singleton instances */ @@ -347,6 +342,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase */ public function canLogUserInWithoutAnonymousSession() { + $GLOBALS['BE_USER'] = []; // This setup fakes the "getAuthInfoArray() db call $queryBuilderProphecy = $this->prophesize(QueryBuilder::class); $connectionPoolProphecy = $this->prophesize(ConnectionPool::class);