[TASK] Make felogin/Test/Unit notice free 03/57903/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 14 Aug 2018 19:12:41 +0000 (21:12 +0200)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Tue, 14 Aug 2018 19:29:42 +0000 (21:29 +0200)
Resolves: #85852
Releases: master
Change-Id: Ifb95317341b9912cd59eb9a0c9fc5ebb9abeb6f4
Reviewed-on: https://review.typo3.org/57903
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php
typo3/sysext/felogin/Tests/Unit/Controller/FrontendLoginControllerTest.php

index 7b49f38..9286858 100644 (file)
@@ -751,7 +751,9 @@ class FrontendLoginController extends AbstractPlugin implements LoggerAwareInter
                             // Allowed domains to redirect to, can be configured with plugin.tx_felogin_pi1.domains
                             // Thanks to plan2.net / Martin Kutschker for implementing this feature.
                             // also avoid redirect when logging in after changing password
-                            if ($this->conf['domains'] && $this->piVars['redirectReferrer'] !== 'off') {
+                            if (isset($this->conf['domains']) && $this->conf['domains']
+                                && (!isset($this->piVars['redirectReferrer']) || $this->piVars['redirectReferrer'] !== 'off')
+                            ) {
                                 $url = $this->referer;
                                 // Is referring url allowed to redirect?
                                 $match = [];
@@ -1052,7 +1054,7 @@ class FrontendLoginController extends AbstractPlugin implements LoggerAwareInter
             if ($parsedUrl['scheme'] === 'http' || $parsedUrl['scheme'] === 'https') {
                 $host = $parsedUrl['host'];
                 // Removes the last path segment and slash sequences like /// (if given):
-                $path = preg_replace('#/+[^/]*$#', '', $parsedUrl['path']);
+                $path = preg_replace('#/+[^/]*$#', '', $parsedUrl['path'] ?? '');
 
                 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_domain');
                 $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
index 3603104..be3ed60 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Felogin\Tests\Unit\Controller;
 
 /*
@@ -25,18 +26,14 @@ use TYPO3\CMS\Core\Database\Query\QueryBuilder;
 use TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class FrontendLoginControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class FrontendLoginControllerTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var \TYPO3\CMS\Felogin\Controller\FrontendLoginController|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
      */
     protected $accessibleFixture;