[BUGFIX] Refine the error message of checkMaximumFileUploadSize 81/31881/2
authorMarkus Klein <klein.t3@reelworx.at>
Sun, 27 Jul 2014 20:44:50 +0000 (22:44 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 28 Jul 2014 13:31:36 +0000 (15:31 +0200)
The Install Tool check the PHP configuration for the maximum file
upload size within the checkMaximumFileUploadSize() method.
This method issues an error message in case the values do not fit.
The error message outputs the values in MB which might give a
wrong indication to the user, as the values seem to be equal
although the check complains they are not.

Provide better output by giving those numbers in KB rather than MB,
which will show diverging numbers correctly then.

Resolves: #60627
Releases: 6.3, 6.2
Change-Id: I5faa4ceb4d7279278182716c31bf6d6dcb851052
Reviewed-on: http://review.typo3.org/31881
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index f5a3de2..63f7e04 100644 (file)
@@ -175,13 +175,13 @@ class Check {
         */
        protected function checkMaximumFileUploadSize() {
                $maximumUploadFilesize = $this->getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
         */
        protected function checkMaximumFileUploadSize() {
                $maximumUploadFilesize = $this->getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
-               $configuredMaximumUploadFilesize = 1024 * $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'];
+               $configuredMaximumUploadFilesize = 1024 * (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'];
                if ($maximumUploadFilesize < $configuredMaximumUploadFilesize) {
                        $status = new Status\ErrorStatus();
                        $status->setTitle('PHP Maximum upload filesize too small');
                        $status->setMessage(
                if ($maximumUploadFilesize < $configuredMaximumUploadFilesize) {
                        $status = new Status\ErrorStatus();
                        $status->setTitle('PHP Maximum upload filesize too small');
                        $status->setMessage(
-                               'PHP upload_max_filesize = ' . (int)ini_get('upload_max_filesize') . ' MB' . LF .
-                               'TYPO3_CONF_VARS[BE][maxFileSize] = ' . (int)($configuredMaximumUploadFilesize / 1024 / 1024) . ' MB' . LF . LF .
+                               'PHP upload_max_filesize = ' . (int)($maximumUploadFilesize / 1024) . ' KB' . LF .
+                               'TYPO3_CONF_VARS[BE][maxFileSize] = ' . (int)($configuredMaximumUploadFilesize / 1024) . ' KB' . LF . LF .
                                'Currently PHP determines the limits for uploaded file\'s sizes and not TYPO3.' .
                                ' It is recommended that the value of upload_max_filesize is at least equal to the value' .
                                ' of TYPO3_CONF_VARS[BE][maxFileSize].'
                                'Currently PHP determines the limits for uploaded file\'s sizes and not TYPO3.' .
                                ' It is recommended that the value of upload_max_filesize is at least equal to the value' .
                                ' of TYPO3_CONF_VARS[BE][maxFileSize].'
@@ -1331,6 +1331,6 @@ class Check {
                } elseif (stripos($measurement, 'K')) {
                        $bytes *= 1024;
                }
                } elseif (stripos($measurement, 'K')) {
                        $bytes *= 1024;
                }
-               return $bytes;
+               return (int)$bytes;
        }
 }
        }
 }