From 3af595b37d27079759f27507005eaa3b7e90f098 Mon Sep 17 00:00:00 2001 From: Wouter Wolters <typo3@wouterwolters.nl> Date: Wed, 4 Jul 2018 20:45:58 +0200 Subject: [PATCH] [TASK] Replace gettype calls type-specific checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: #85479 Releases: master Change-Id: I576ab5fb6a7937016497a93d3b4dd025478e81bd Reviewed-on: https://review.typo3.org/57468 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Jörg Bösche <typo3@joergboesche.de> Tested-by: Jörg Bösche <typo3@joergboesche.de> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> --- typo3/sysext/frontend/Classes/Controller/ErrorController.php | 2 +- .../Classes/Controller/TypoScriptFrontendController.php | 2 +- .../sysext/saltedpasswords/Tests/Unit/Salt/Argon2iSaltTest.php | 2 +- typo3/sysext/saltedpasswords/Tests/Unit/Salt/BcryptSaltTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/frontend/Classes/Controller/ErrorController.php b/typo3/sysext/frontend/Classes/Controller/ErrorController.php index 669b6a97e491..8b8aea124bf9 100644 --- a/typo3/sysext/frontend/Classes/Controller/ErrorController.php +++ b/typo3/sysext/frontend/Classes/Controller/ErrorController.php @@ -144,7 +144,7 @@ class ErrorController $response = null; $content = ''; // Simply boolean; Just shows TYPO3 error page with reason: - if (gettype($errorHandler) === 'boolean' || strtolower($errorHandler) === 'true' || (string)$errorHandler === '1') { + if (is_bool($errorHandler) || strtolower($errorHandler) === 'true' || (string)$errorHandler === '1') { $content = GeneralUtility::makeInstance(ErrorPageController::class)->errorAction( 'Page Not Found', 'The page did not exist or was inaccessible.' . ($reason ? ' Reason: ' . $reason : '') diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 9160cc9f60de..30340ca9569a 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -1975,7 +1975,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface } // Create response: // Simply boolean; Just shows TYPO3 error page with reason: - if (strtolower($code) === 'true' || (string)$code === '1' || gettype($code) === 'boolean') { + if (strtolower($code) === 'true' || (string)$code === '1' || is_bool($code)) { echo GeneralUtility::makeInstance(ErrorPageController::class)->errorAction( 'Page Not Found', 'The page did not exist or was inaccessible.' . ($reason ? ' Reason: ' . $reason : '') diff --git a/typo3/sysext/saltedpasswords/Tests/Unit/Salt/Argon2iSaltTest.php b/typo3/sysext/saltedpasswords/Tests/Unit/Salt/Argon2iSaltTest.php index 576851735a91..9debc7cf1b76 100644 --- a/typo3/sysext/saltedpasswords/Tests/Unit/Salt/Argon2iSaltTest.php +++ b/typo3/sysext/saltedpasswords/Tests/Unit/Salt/Argon2iSaltTest.php @@ -101,7 +101,7 @@ class Argon2iSaltTest extends UnitTestCase { $hash = $this->subject->getHashedPassword('password'); $this->assertNotNull($hash); - $this->assertEquals('string', gettype($hash)); + $this->assertTrue(is_string($hash)); } /** diff --git a/typo3/sysext/saltedpasswords/Tests/Unit/Salt/BcryptSaltTest.php b/typo3/sysext/saltedpasswords/Tests/Unit/Salt/BcryptSaltTest.php index c82b5b185caa..3153ea6e8a9b 100644 --- a/typo3/sysext/saltedpasswords/Tests/Unit/Salt/BcryptSaltTest.php +++ b/typo3/sysext/saltedpasswords/Tests/Unit/Salt/BcryptSaltTest.php @@ -77,7 +77,7 @@ class BcryptSaltTest extends UnitTestCase { $hash = $this->subject->getHashedPassword('password'); $this->assertNotNull($hash); - $this->assertEquals('string', gettype($hash)); + $this->assertTrue(is_string($hash)); } /** -- GitLab