[TASK] Make indexed search tests notice free 95/57895/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 14 Aug 2018 16:40:00 +0000 (18:40 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 14 Aug 2018 17:28:23 +0000 (19:28 +0200)
Resolves: #85845
Releases: master
Change-Id: Id72acfdf7c880f1d0b63a62b912301c724ed500d
Reviewed-on: https://review.typo3.org/57895
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: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/indexed_search/Classes/Indexer.php
typo3/sysext/indexed_search/Tests/Unit/IndexerTest.php

index 002b99b..ed3bd3a 100644 (file)
@@ -992,7 +992,7 @@ class Indexer
     protected function createLocalPathFromT3vars($sourcePath)
     {
         $localPath = '';
-        $indexLocalFiles = $GLOBALS['T3_VAR']['ext']['indexed_search']['indexLocalFiles'];
+        $indexLocalFiles = $GLOBALS['T3_VAR']['ext']['indexed_search']['indexLocalFiles'] ?? null;
         if (is_array($indexLocalFiles)) {
             $md5 = GeneralUtility::shortMD5($sourcePath);
             // Note: not using self::isAllowedLocalFile here because this method
@@ -1036,7 +1036,7 @@ class Indexer
     protected function createLocalPathUsingAbsRefPrefix($sourcePath)
     {
         $localPath = '';
-        if ($GLOBALS['TSFE'] instanceof \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController) {
+        if (isset($GLOBALS['TSFE']) && $GLOBALS['TSFE'] instanceof TypoScriptFrontendController) {
             $absRefPrefix = $GLOBALS['TSFE']->config['config']['absRefPrefix'];
             $absRefPrefixLength = strlen($absRefPrefix);
             if ($absRefPrefixLength > 0 && substr($sourcePath, 0, $absRefPrefixLength) == $absRefPrefix) {
@@ -1097,7 +1097,7 @@ class Indexer
     protected static function isRelativeURL($url)
     {
         $urlParts = @parse_url($url);
-        return $urlParts['scheme'] == '' && $urlParts['path'][0] !== '/';
+        return (!isset($urlParts['scheme']) || $urlParts['scheme'] === '') && $urlParts['path'][0] !== '/';
     }
 
     /**
index 8cc3558..ecf2bf8 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\IndexedSearch\Tests\Unit;
 
 /*
@@ -30,11 +31,6 @@ class IndexerTest extends UnitTestCase
     protected $resetSingletonInstances = true;
 
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @test
      */
     public function extractHyperLinksDoesNotReturnNonExistingLocalPath()