[BUGFIX] Handle post_max_size = 0 60/38660/2
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:46:09 +0000 (16:46 +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/38660
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index 21f9898..40132ba 100755 (executable)
@@ -3166,7 +3166,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 0536143..59ed204 100644 (file)
@@ -206,7 +206,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(
@@ -1457,4 +1457,5 @@ class Check {
                }
                return (int)$bytes;
        }
+
 }