From: Mario Rimann Date: Fri, 2 Dec 2011 21:10:25 +0000 (+0100) Subject: [BUGFIX] Unlimited memory limit handling in system status report X-Git-Tag: TYPO3_4-5-12~48 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/aa6d46b0b0d59941ebedeb79a88fe1da1b72368a [BUGFIX] Unlimited memory limit handling in system status report According to the documentation, "-1" is a valid setting for PHP's memory_limit and means "unlimited". So far this value has caused the system status report to report this value as an error. Change-Id: I2fbdbf8b9e39dd0425253f5487b869bc81f52e27 Fixes: #32231 Releases: 4.7, 4.6, 4.5 Reviewed-on: http://review.typo3.org/7793 Reviewed-by: Wouter Wolters Tested-by: Wouter Wolters Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- diff --git a/typo3/sysext/reports/reports/locallang.xml b/typo3/sysext/reports/reports/locallang.xml index 84994ed5cabd..60f1bc9ae049 100644 --- a/typo3/sysext/reports/reports/locallang.xml +++ b/typo3/sysext/reports/reports/locallang.xml @@ -44,6 +44,7 @@ + diff --git a/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_systemstatus.php b/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_systemstatus.php index e21dc5378e63..7bc8d1df9842 100644 --- a/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_systemstatus.php +++ b/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_systemstatus.php @@ -79,29 +79,36 @@ class tx_reports_reports_status_SystemStatus implements tx_reports_StatusProvide */ protected function getPhpMemoryLimitStatus() { $memoryLimit = ini_get('memory_limit'); + $memoryLimitBytes = t3lib_div::getBytesFromSizeMeasurement($memoryLimit); $message = ''; $severity = tx_reports_reports_status_Status::OK; - if ($memoryLimit && t3lib_div::getBytesFromSizeMeasurement($memoryLimit) < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT)) { - $message = sprintf($GLOBALS['LANG']->getLL('status_phpMemoryRecommendation'), $memoryLimit, TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT); - $severity = tx_reports_reports_status_Status::WARNING; - } + if ($memoryLimitBytes > 0) { + if ($memoryLimitBytes < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT)) { + $message = sprintf($GLOBALS['LANG']->getLL('status_phpMemoryRecommendation'), $memoryLimit, TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT); + $severity = tx_reports_reports_status_Status::WARNING; + } - if ($memoryLimit && t3lib_div::getBytesFromSizeMeasurement($memoryLimit) < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT)) { - $message = sprintf($GLOBALS['LANG']->getLL('status_phpMemoryRequirement'), $memoryLimit, TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT); - $severity = tx_reports_reports_status_Status::ERROR; - } + if ($memoryLimitBytes < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT)) { + $message = sprintf($GLOBALS['LANG']->getLL('status_phpMemoryRequirement'), $memoryLimit, TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT); + $severity = tx_reports_reports_status_Status::ERROR; + } - if ($severity > tx_reports_reports_status_Status::OK) { - if ($php_ini_path = get_cfg_var('cfg_file_path')) { - $message .= ' ' . sprintf($GLOBALS['LANG']->getLL('status_phpMemoryEditLimit'), $php_ini_path); - } else { - $message .= ' ' . $GLOBALS['LANG']->getLL('status_phpMemoryContactAdmin'); + if ($severity > tx_reports_reports_status_Status::OK) { + if ($php_ini_path = get_cfg_var('cfg_file_path')) { + $message .= ' ' . sprintf($GLOBALS['LANG']->getLL('status_phpMemoryEditLimit'), $php_ini_path); + } else { + $message .= ' ' . $GLOBALS['LANG']->getLL('status_phpMemoryContactAdmin'); + } } } - return t3lib_div::makeInstance('tx_reports_reports_status_Status', - $GLOBALS['LANG']->getLL('status_phpMemory'), $memoryLimit, $message, $severity + return t3lib_div::makeInstance( + 'tx_reports_reports_status_Status', + $GLOBALS['LANG']->getLL('status_phpMemory'), + ($memoryLimitBytes > 0 ? $memoryLimit : $GLOBALS['LANG']->getLL('status_phpMemoryUnlimited')), + $message, + $severity ); }