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
<label index="status_phpMemoryRequirement">Depending on your configuration, TYPO3 can run with a %1$s PHP memory limit. However, a %2$s PHP memory limit or above is required especially if your site uses additional extensions.</label>
<label index="status_phpMemoryEditLimit">Increase the memory limit by editing the memory_limit parameter in the file %s and then restart your web server (or contact your system administrator or hosting provider for assistance).</label>
<label index="status_phpMemoryContactAdmin">Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.</label>
<label index="status_phpMemoryRequirement">Depending on your configuration, TYPO3 can run with a %1$s PHP memory limit. However, a %2$s PHP memory limit or above is required especially if your site uses additional extensions.</label>
<label index="status_phpMemoryEditLimit">Increase the memory limit by editing the memory_limit parameter in the file %s and then restart your web server (or contact your system administrator or hosting provider for assistance).</label>
<label index="status_phpMemoryContactAdmin">Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.</label>
+ <label index="status_phpMemoryUnlimited">unlimited</label>
<label index="status_phpRegisterGlobals">PHP Register Globals</label>
<label index="status_phpRegisterGlobalsEnabled">%s is enabled. TYPO3 requires this configuration directive to be disabled.</label>
<label index="status_phpRegisterGlobalsSecurity">Your site may not be secure when %s is enabled.</label>
<label index="status_phpRegisterGlobals">PHP Register Globals</label>
<label index="status_phpRegisterGlobalsEnabled">%s is enabled. TYPO3 requires this configuration directive to be disabled.</label>
<label index="status_phpRegisterGlobalsSecurity">Your site may not be secure when %s is enabled.</label>
*/
protected function getPhpMemoryLimitStatus() {
$memoryLimit = ini_get('memory_limit');
*/
protected function getPhpMemoryLimitStatus() {
$memoryLimit = ini_get('memory_limit');
+ $memoryLimitBytes = t3lib_div::getBytesFromSizeMeasurement($memoryLimit);
$message = '';
$severity = tx_reports_reports_status_Status::OK;
$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