[TASK] Missing report for deprecated setting magic_quotes_gpc
authorXavier Perseguers <xavier@typo3.org>
Tue, 20 Sep 2011 09:11:44 +0000 (11:11 +0200)
committerXavier Perseguers <xavier@typo3.org>
Tue, 20 Sep 2011 11:34:40 +0000 (13:34 +0200)
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
t3lib/utility/class.t3lib_utility_phpoptions.php
typo3/sysext/reports/reports/locallang.xlf
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php

index a103ec7..0875ebc 100644 (file)
@@ -43,6 +43,21 @@ final class t3lib_utility_PhpOptions {
        }
 
        /**
+        * 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
         *
         * @return boolean TRUE if sql.safe_mode is enabled, FALSE if disabled
index 3a8516c..019eeaf 100644 (file)
                                <source>PHP safe_mode</source>
                                <target>PHP safe_mode</target>
                        </trans-unit>
+                       <trans-unit id="status_PhpMagicQuotesGpc" approved="yes">
+                               <source>PHP magic_quotes_gpc</source>
+                               <target>PHP magic_quotes_gpc</target>
+                       </trans-unit>
                        <trans-unit id="status_adminUserAccount" approved="yes">
                                <source>Admin User Account</source>
                                <target>Admin User Account</target>
                                <source>PHP INI setting safe_mode "On" is deprecated since PHP 5.3 and is not supported by TYPO3 anymore.</source>
                                <target>PHP INI setting safe_mode "On" is deprecated since PHP 5.3 and is not supported by TYPO3 anymore.</target>
                        </trans-unit>
+                       <trans-unit id="status_configuration_PhpMagicQuotesGpcEnabled" approved="yes">
+                               <source>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.</source>
+                               <target>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.</target>
+                       </trans-unit>
                        <trans-unit id="status_updateTaskTitle" approved="yes">
                                <source>System Status Update</source>
                                <target>System Status Update</target>
index e5fd9fe..d91a42e 100644 (file)
@@ -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()) {
@@ -117,6 +118,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.
         *
         * @return      boolean TRUE if memcached is used, FALSE otherwise.