[BUGFIX] Handle post_max_size = 0 36/38436/3
authorMarkus Klein <klein.t3@reelworx.at>
Thu, 2 Apr 2015 15:35:53 +0000 (17:35 +0200)
committerXavier Perseguers <xavier@typo3.org>
Mon, 13 Apr 2015 14:43:48 +0000 (16:43 +0200)
Although the PHP docs do not mention it, the default configuration
files in the repository explain that post_max_size = 0 means
"unlimited" size.

Adjust the checks in the code to adhere to that.

Releases: master, 6.2
Resolves: #66208
Change-Id: I256512fea5ef71fa570ad4fe925145c403c80989
Reviewed-on: http://review.typo3.org/38436
Reviewed-by: Stephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Stephan Großberndt <stephan@grossberndt.de>
Tested-by: Xavier Perseguers <xavier@typo3.org>
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index c838eef..ad07671 100755 (executable)
@@ -3042,7 +3042,7 @@ Connection: close
                $phpPostLimit = self::getBytesFromSizeMeasurement(ini_get('post_max_size'));
                // 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 < $phpUploadLimit ? $phpPostLimit : $phpUploadLimit;
+               $phpUploadLimit = $phpPostLimit > 0 && $phpPostLimit < $phpUploadLimit ? $phpPostLimit : $phpUploadLimit;
                // Is the allowed PHP limit (upload_max_filesize) lower than the TYPO3 limit?, also: revert back to KB
                return floor(($phpUploadLimit < $t3Limit ? $phpUploadLimit : $t3Limit)) / 1024;
        }
index 8bd9e8d..23ffc65 100644 (file)
@@ -204,7 +204,7 @@ class Check {
        protected function checkPostUploadSizeIsHigherOrEqualMaximumFileUploadSize() {
                $maximumUploadFilesize = $this->getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
                $maximumPostSize = $this->getBytesFromSizeMeasurement(ini_get('post_max_size'));
-               if ($maximumPostSize < $maximumUploadFilesize) {
+               if ($maximumPostSize > 0 && $maximumPostSize < $maximumUploadFilesize) {
                        $status = new Status\ErrorStatus();
                        $status->setTitle('Maximum size for POST requests is smaller than maximum upload filesize in PHP');
                        $status->setMessage(
@@ -1432,4 +1432,4 @@ class Check {
                return (int)$bytes;
        }
 
-}
\ No newline at end of file
+}