diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 76289de8d8f99abbd038b5036406edc0fb0126e6..bf9f4c4fa78a15fbc9f758bed82c600daf04a058 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -2814,12 +2814,12 @@ class GeneralUtility if ($proxySSL === '*') { $proxySSL = $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP']; } - if (self::cmpIP($_SERVER['REMOTE_ADDR'], $proxySSL)) { + if (self::cmpIP($_SERVER['REMOTE_ADDR'] ?? '', $proxySSL)) { $retVal = true; } else { // https://secure.php.net/manual/en/reserved.variables.server.php // "Set to a non-empty value if the script was queried through the HTTPS protocol." - $retVal = $_SERVER['SSL_SESSION_ID'] + $retVal = !empty($_SERVER['SSL_SESSION_ID']) || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off'); } break; diff --git a/typo3/sysext/extbase/Tests/Unit/Service/ImageScriptServiceTest.php b/typo3/sysext/extbase/Tests/Unit/Service/ImageScriptServiceTest.php index c7be01bd0d083549dac762d010e3bae142dac02e..14eb1dca7593275a018137af1254e9a3455f573a 100644 --- a/typo3/sysext/extbase/Tests/Unit/Service/ImageScriptServiceTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Service/ImageScriptServiceTest.php @@ -1,4 +1,5 @@ <?php +declare(strict_types = 1); namespace TYPO3\CMS\Extbase\Tests\Unit\Service; /* @@ -20,17 +21,13 @@ use TYPO3\CMS\Core\Resource\ProcessedFile; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Service\EnvironmentService; use TYPO3\CMS\Extbase\Service\ImageService; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** * Test case */ -class ImageScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +class ImageScriptServiceTest extends UnitTestCase { - /** - * Subject is not notice free, disable E_NOTICES - */ - protected static $suppressNotices = true; - /** * @var ImageService */ @@ -44,7 +41,7 @@ class ImageScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC /** * Initialize ImageService and environment service mock */ - protected function setUp() + protected function setUp(): void { $this->environmentService = $this->createMock(EnvironmentService::class); $this->subject = new ImageService($this->environmentService); @@ -55,7 +52,7 @@ class ImageScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC /** * @test */ - public function fileIsUnwrappedFromReferenceForProcessing() + public function fileIsUnwrappedFromReferenceForProcessing(): void { $reference = $this->getAccessibleMock(FileReference::class, [], [], '', false); $file = $this->createMock(File::class); @@ -69,7 +66,7 @@ class ImageScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC /** * @return array */ - public function prefixIsCorrectlyAppliedToGetImageUriDataProvider() + public function prefixIsCorrectlyAppliedToGetImageUriDataProvider(): array { return [ 'with scheme' => ['http://foo.bar/img.jpg', 'http://foo.bar/img.jpg'], @@ -82,7 +79,7 @@ class ImageScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC * @test * @dataProvider prefixIsCorrectlyAppliedToGetImageUriDataProvider */ - public function prefixIsCorrectlyAppliedToGetImageUri($imageUri, $expected) + public function prefixIsCorrectlyAppliedToGetImageUri($imageUri, $expected): void { $this->environmentService->expects($this->any())->method('isEnvironmentInFrontendMode')->willReturn(true); $GLOBALS['TSFE'] = new \stdClass(); @@ -97,7 +94,7 @@ class ImageScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC /** * @return array */ - public function prefixIsCorrectlyAppliedToGetImageUriWithAbsolutePathDataProvider() + public function prefixIsCorrectlyAppliedToGetImageUriWithAbsolutePathDataProvider(): array { return [ 'with scheme' => ['http://foo.bar/img.jpg', 'http://foo.bar/img.jpg'], @@ -110,7 +107,7 @@ class ImageScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestC * @test * @dataProvider prefixIsCorrectlyAppliedToGetImageUriWithAbsolutePathDataProvider */ - public function prefixIsCorrectlyAppliedToGetImageUriWithForcedAbsoluteUrl($imageUri, $expected) + public function prefixIsCorrectlyAppliedToGetImageUriWithForcedAbsoluteUrl($imageUri, $expected): void { $this->environmentService->expects($this->any())->method('isEnvironmentInFrontendMode')->willReturn(true); $GLOBALS['TSFE'] = new \stdClass();