[TASK] Make PageRepositoryTest notice free 24/56824/3
authorSybille Peters <sypets@gmx.de>
Sat, 28 Apr 2018 10:04:58 +0000 (12:04 +0200)
committerAndreas Wolf <andreas.wolf@typo3.org>
Fri, 4 May 2018 13:28:33 +0000 (15:28 +0200)
Resolves: #84889
Releases: master
Change-Id: Ied9640b8cf664086a5533b910e5ff2b1a2e6aece
Reviewed-on: https://review.typo3.org/56824
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Fabien Udriot <fabien.udriot@ecodev.ch>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/frontend/Classes/Page/PageRepository.php
typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php

index 175394b..ebe24a8 100644 (file)
@@ -2624,11 +2624,11 @@ class GeneralUtility
         switch ((string)$getEnvName) {
             case 'SCRIPT_NAME':
                 $retVal = self::isRunningOnCgiServerApi()
-                    && ($_SERVER['ORIG_PATH_INFO'] ?: $_SERVER['PATH_INFO'])
-                        ? ($_SERVER['ORIG_PATH_INFO'] ?: $_SERVER['PATH_INFO'])
-                        : ($_SERVER['ORIG_SCRIPT_NAME'] ?: $_SERVER['SCRIPT_NAME']);
+                    && (($_SERVER['ORIG_PATH_INFO'] ?? false) ?: ($_SERVER['PATH_INFO'] ?? false))
+                        ? (($_SERVER['ORIG_PATH_INFO'] ?? '') ?: ($_SERVER['PATH_INFO'] ?? ''))
+                        : (($_SERVER['ORIG_SCRIPT_NAME'] ?? '') ?: ($_SERVER['SCRIPT_NAME'] ?? ''));
                 // Add a prefix if TYPO3 is behind a proxy: ext-domain.com => int-server.com/prefix
-                if (self::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP'])) {
+                if (self::cmpIP(($_SERVER['REMOTE_ADDR'] ?? ''), $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP'])) {
                     if (self::getIndpEnv('TYPO3_SSL') && $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyPrefixSSL']) {
                         $retVal = $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyPrefixSSL'] . $retVal;
                     } elseif ($GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyPrefix']) {
index 1b98f69..ce9ecca 100644 (file)
@@ -206,7 +206,7 @@ class PageRepository implements LoggerAwareInterface
             // versioning preview (that means we are online!)
             $this->where_hid_del = $this->enableFields('pages', $show_hidden, ['fe_group' => true], true);
         }
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::class]['init'])) {
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::class]['init'] ?? false)) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::class]['init'] as $classRef) {
                 $hookObject = GeneralUtility::makeInstance($classRef);
                 if (!$hookObject instanceof PageRepositoryInitHookInterface) {
@@ -990,7 +990,7 @@ class PageRepository implements LoggerAwareInterface
             $uI = parse_url($redirectTo);
             // If relative path, prefix Site URL
             // If it's a valid email without protocol, add "mailto:"
-            if (!$uI['scheme']) {
+            if (!($uI['scheme'] ?? false)) {
                 if (GeneralUtility::validEmail($redirectTo)) {
                     $redirectTo = 'mailto:' . $redirectTo;
                 } elseif ($redirectTo[0] !== '/') {
@@ -1361,15 +1361,15 @@ class PageRepository implements LoggerAwareInterface
                 // In case of versioning-preview, enableFields are ignored (checked in
                 // versionOL())
                 if (!$this->versioningPreview || !$ctrl['versioningWS'] || $noVersionPreview) {
-                    if ($ctrl['enablecolumns']['disabled'] && !$show_hidden && !$ignore_array['disabled']) {
+                    if (($ctrl['enablecolumns']['disabled'] ?? false) && !$show_hidden && !($ignore_array['disabled'] ?? false)) {
                         $field = $table . '.' . $ctrl['enablecolumns']['disabled'];
                         $constraints[] = $expressionBuilder->eq($field, 0);
                     }
-                    if ($ctrl['enablecolumns']['starttime'] && !$ignore_array['starttime']) {
+                    if (($ctrl['enablecolumns']['starttime'] ?? false) && !($ignore_array['starttime'] ?? false)) {
                         $field = $table . '.' . $ctrl['enablecolumns']['starttime'];
                         $constraints[] = $expressionBuilder->lte($field, (int)$GLOBALS['SIM_ACCESS_TIME']);
                     }
-                    if ($ctrl['enablecolumns']['endtime'] && !$ignore_array['endtime']) {
+                    if (($ctrl['enablecolumns']['endtime'] ?? false) && !($ignore_array['endtime'] ?? false)) {
                         $field = $table . '.' . $ctrl['enablecolumns']['endtime'];
                         $constraints[] = $expressionBuilder->orX(
                             $expressionBuilder->eq($field, 0),
index 1fcd024..ec63f48 100644 (file)
@@ -20,11 +20,6 @@ namespace TYPO3\CMS\Frontend\Tests\Unit\Page;
 class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var \TYPO3\CMS\Frontend\Page\PageRepository|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
      */
     protected $pageSelectObject;