From: Xavier Perseguers Date: Tue, 20 Sep 2011 09:11:44 +0000 (+0200) Subject: [TASK] Missing report for deprecated setting magic_quotes_gpc X-Git-Tag: TYPO3_4-6-0beta3~7 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/c548c58f598a442629a17853611e8a8c2fcde5fa [TASK] Missing report for deprecated setting magic_quotes_gpc Since PHP 5.3, PHP INI setting magic_quotes_gpc is deprecated but still defaults to "On". A report should be added to raise awareness of the administrators. Change-Id: Icdaeee1ea054bda1f26c5d3060e74006e7077e26 Resolves: #30079 Releases: 4.6 Reviewed-on: http://review.typo3.org/5101 Reviewed-by: Jigal van Hemert Tested-by: Jigal van Hemert Reviewed-by: Stefan Neufeind Reviewed-by: Xavier Perseguers Tested-by: Xavier Perseguers --- diff --git a/t3lib/utility/class.t3lib_utility_phpoptions.php b/t3lib/utility/class.t3lib_utility_phpoptions.php index a103ec7f0916..0875ebc5f6bc 100644 --- a/t3lib/utility/class.t3lib_utility_phpoptions.php +++ b/t3lib/utility/class.t3lib_utility_phpoptions.php @@ -42,6 +42,21 @@ final class t3lib_utility_PhpOptions { return self::getIniValueBoolean('safe_mode'); } + /** + * Check if php magic_quotes_gpc is enabled + * + * @return boolean TRUE if magic_quotes_gpc is enabled, FALSE if disabled + */ + public static function isMagicQuotesGpcEnabled() { + // TODO: Once PHP 5.4.0 is out, check if magic_quotes_gpc was really removed + //if (version_compare(phpversion(), '5.4', '<')) { + // return self::getIniValueBoolean('magic_quotes_gpc'); + //} else { + // return FALSE; + //} + return self::getIniValueBoolean('magic_quotes_gpc'); + } + /** * Check if php sql.safe_mode is enabled * diff --git a/typo3/sysext/reports/reports/locallang.xlf b/typo3/sysext/reports/reports/locallang.xlf index 3a8516cba4a7..019eeaf2fd0d 100644 --- a/typo3/sysext/reports/reports/locallang.xlf +++ b/typo3/sysext/reports/reports/locallang.xlf @@ -87,6 +87,10 @@ PHP safe_mode PHP safe_mode + + PHP magic_quotes_gpc + PHP magic_quotes_gpc + Admin User Account Admin User Account @@ -199,6 +203,10 @@ PHP INI setting safe_mode "On" is deprecated since PHP 5.3 and is not supported by TYPO3 anymore. PHP INI setting safe_mode "On" is deprecated since PHP 5.3 and is not supported by TYPO3 anymore. + + PHP INI setting magic_quotes_gpc "On" is deprecated since PHP 5.3. You are advised to set it to "Off" until it gets completely removed. + PHP INI setting magic_quotes_gpc "On" is deprecated since PHP 5.3. You are advised to set it to "Off" until it gets completely removed. + System Status Update System Status Update diff --git a/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php b/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php index e5fd9fe0e082..d91a42e87f9e 100644 --- a/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php +++ b/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php @@ -52,9 +52,10 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status */ public function getStatus() { $statuses = array( - 'emptyReferenceIndex' => $this->getReferenceIndexStatus(), - 'deprecationLog' => $this->getDeprecationLogStatus(), - 'safeModeEnabled' => $this->getPhpSafeModeStatus() + 'emptyReferenceIndex' => $this->getReferenceIndexStatus(), + 'deprecationLog' => $this->getDeprecationLogStatus(), + 'safeModeEnabled' => $this->getPhpSafeModeStatus(), + 'magicQuotesGpcEnabled' => $this->getPhpMagicQuotesGpcStatus(), ); if ($this->isMemcachedUsed()) { @@ -116,6 +117,27 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status ); } + /** + * Checks if PHP magic_quotes_gpc is enabled. + * + * @return tx_reports_reports_status_Status A tx_reports_reports_status_Status object representing whether the magic_quote_gpc is enabled or not + */ + protected function getPhpMagicQuotesGpcStatus() { + $value = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:disabled'); + $message = ''; + $severity = tx_reports_reports_status_Status::OK; + + if (t3lib_utility_PhpOptions::isMagicQuotesGpcEnabled()) { + $value = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:enabled'); + $severity = tx_reports_reports_status_Status::WARNING; + $message = $GLOBALS['LANG']->getLL('status_configuration_PhpMagicQuotesGpcEnabled'); + } + + return t3lib_div::makeInstance('tx_reports_reports_status_Status', + $GLOBALS['LANG']->getLL('status_PhpMagicQuotesGpc'), $value, $message, $severity + ); + } + /** * Checks whether memcached is configured, if that's the case we asume it's also used. *