[TASK] PHP 5.4 adjustments
authorMarkus Klein <klein.t3@mfc-linz.at>
Tue, 6 Mar 2012 10:42:54 +0000 (11:42 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Sun, 11 Mar 2012 11:48:09 +0000 (12:48 +0100)
Small adjustments for PHP 5.4 compatibility.

Change-Id: I0ce1c8901a940980f2a753ee219fb6b01497cac8
Resolves: #34685
Releases: 4.8, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/9511
Reviewed-by: Sebastian Fischer
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
t3lib/utility/class.t3lib_utility_phpoptions.php
typo3/init.php
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php

index 73daa74..3475dc3 100644 (file)
@@ -39,7 +39,10 @@ final class t3lib_utility_PhpOptions {
         * @return boolean TRUE if safe_mode is enabled, FALSE if disabled
         */
        public static function isSafeModeEnabled() {
-               return self::getIniValueBoolean('safe_mode');
+               if (version_compare(phpversion(), '5.4', '<')) {
+                       return self::getIniValueBoolean('safe_mode');
+               }
+               return FALSE;
        }
 
        /**
@@ -48,13 +51,10 @@ final class t3lib_utility_PhpOptions {
         * @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');
+               if (version_compare(phpversion(), '5.4', '<')) {
+                       return self::getIniValueBoolean('magic_quotes_gpc');
+               }
+               return FALSE;
        }
 
        /**
index 0ab1014..1f04f17 100644 (file)
@@ -324,8 +324,10 @@ if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && !(TYPO3_REQUESTTYPE & TYPO3_REQ
 // *******************************
 // Checking environment
 // *******************************
-if (isset($_POST['GLOBALS']) || isset($_GET['GLOBALS']))       die('You cannot set the GLOBALS-array from outside the script.');
-if (!version_compare(phpversion(), '5.4', '<') || !get_magic_quotes_gpc()) {
+if (isset($_POST['GLOBALS']) || isset($_GET['GLOBALS'])) {
+       die('You cannot set the GLOBALS-array from outside the script.');
+}
+if (!get_magic_quotes_gpc()) {
        t3lib_div::addSlashesOnArray($_GET);
        t3lib_div::addSlashesOnArray($_POST);
        $HTTP_GET_VARS = $_GET;
index fb72101..c31a554 100644 (file)
@@ -55,11 +55,15 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status
 
                $statuses = array(
                        'emptyReferenceIndex'   => $this->getReferenceIndexStatus(),
-                       'deprecationLog'        => $this->getDeprecationLogStatus(),
-                       'safeModeEnabled'       => $this->getPhpSafeModeStatus(),
-                       'magicQuotesGpcEnabled' => $this->getPhpMagicQuotesGpcStatus(),
+                       'deprecationLog'        => $this->getDeprecationLogStatus()
                );
 
+                       // Do not show status about non-existant features
+               if (version_compare(phpversion(), '5.4', '<')) {
+                       $statuses['safeModeEnabled'] = $this->getPhpSafeModeStatus();
+                       $statuses['magicQuotesGpcEnabled'] = $this->getPhpMagicQuotesGpcStatus();
+               }
+
                if ($this->isMemcachedUsed()) {
                        $statuses['memcachedConnection'] = $this->getMemcachedConnectionStatus();
                }