From 53cd95c8cca552bc44a8f40434cbb58017e5ad64 Mon Sep 17 00:00:00 2001 From: Sybille Peters <sypets@gmx.de> Date: Sat, 28 Apr 2018 12:04:58 +0200 Subject: [PATCH] [TASK] Make PageRepositoryTest notice free 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 | 8 ++++---- typo3/sysext/frontend/Classes/Page/PageRepository.php | 10 +++++----- .../frontend/Tests/Unit/Page/PageRepositoryTest.php | 5 ----- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 175394befea2..ebe24a87edd9 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -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']) { diff --git a/typo3/sysext/frontend/Classes/Page/PageRepository.php b/typo3/sysext/frontend/Classes/Page/PageRepository.php index 1b98f6951221..ce9ecca1b4cb 100644 --- a/typo3/sysext/frontend/Classes/Page/PageRepository.php +++ b/typo3/sysext/frontend/Classes/Page/PageRepository.php @@ -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), diff --git a/typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php b/typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php index 1fcd024b142e..ec63f488a799 100644 --- a/typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php @@ -19,11 +19,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 */ -- GitLab