diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 96efba98f5abb07a0b90085c1b267de70b7b4c2c..c7f536218e1b77902206e80f148e14d37dc5ed62 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -1745,11 +1745,6 @@ parameters: count: 3 path: ../../typo3/sysext/core/Classes/Utility/GeneralUtility.php - - - message: "#^Method TYPO3\\\\CMS\\\\Core\\\\Utility\\\\GeneralUtility\\:\\:getMaxUploadFileSize\\(\\) should return int but returns float\\.$#" - count: 1 - path: ../../typo3/sysext/core/Classes/Utility/GeneralUtility.php - - message: "#^Method TYPO3\\\\CMS\\\\Core\\\\Utility\\\\GeneralUtility\\:\\:intExplode\\(\\) should return array\\<int\\> but returns array\\<int, string\\>\\.$#" count: 1 diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 7fce932a0e687f9b1738be54a70bc3250425a66d..8c22887f0810563b05c751dab991bdbd7650ce73 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -2231,7 +2231,7 @@ class GeneralUtility * This might be handy to find out the real upload limit that is possible for this * TYPO3 installation. * - * @return int The maximum size of uploads that are allowed (measured in kilobytes) + * @return int Maximum size of uploads that are allowed in KiB (divider 1024) */ public static function getMaxUploadFileSize() { @@ -2244,7 +2244,7 @@ class GeneralUtility // If the total amount of post data is smaller (!) than the upload_max_filesize directive, // then this is the real limit in PHP $phpUploadLimit = $phpPostLimit > 0 && $phpPostLimit < $phpUploadLimit ? $phpPostLimit : $phpUploadLimit; - return floor($phpUploadLimit) / 1024; + return (int)(floor($phpUploadLimit) / 1024); } /** diff --git a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php index 8d4e3e7432e5f553e49c150adae9dcd239be2d51..c47a16cad9694944f249794a50537a228455efa4 100644 --- a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php +++ b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php @@ -4190,4 +4190,14 @@ class GeneralUtilityTest extends UnitTestCase GeneralUtility::rmdir($testFileDirectory, true); } + + /** + * @test + */ + public function getMaxUploadFileSizeReturnsPositiveInt(): void + { + $result = GeneralUtility::getMaxUploadFileSize(); + self::assertIsInt($result); + self::assertGreaterThan(0, $result); + } }