From ecc21f2e46ffec0757963fd128d3cb5c086fda61 Mon Sep 17 00:00:00 2001
From: Xavier Perseguers <typo3@perseguers.ch>
Date: Fri, 25 Mar 2011 16:53:29 +0100
Subject: [PATCH] [TASK] Remove explicit checks for PHP < 5.3

Make PHP 5.3 a requirement for TYPO3 4.6 and remove tests that check for older
versions of PHP.

Change-Id: Ib73e332a44f618e59f78c8e442d2bf27474c4964
Resolves: #25395
Reviewed-on: http://review.typo3.org/1277
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
---
 index.php                                     |  6 +-----
 t3lib/class.t3lib_div.php                     | 21 +++----------------
 t3lib/class.t3lib_superadmin.php              |  6 +-----
 t3lib/thumbs.php                              |  6 +-----
 typo3/init.php                                |  8 ++-----
 typo3/install/index.php                       |  6 +-----
 typo3/sysext/cms/tslib/index_ts.php           |  6 +-----
 typo3/sysext/cms/tslib/showpic.php            |  6 +-----
 .../install/mod/class.tx_install_ajax.php     |  6 +-----
 typo3/thumbs.php                              |  6 +-----
 10 files changed, 13 insertions(+), 64 deletions(-)

diff --git a/index.php b/index.php
index 8027c0dcf17f..70b82bc0b493 100644
--- a/index.php
+++ b/index.php
@@ -37,11 +37,7 @@
 // Set error reporting
 // *******************************
 
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 
 // ******************
diff --git a/t3lib/class.t3lib_div.php b/t3lib/class.t3lib_div.php
index e6465d38df5c..17a28416b4f6 100644
--- a/t3lib/class.t3lib_div.php
+++ b/t3lib/class.t3lib_div.php
@@ -1434,7 +1434,7 @@ final class t3lib_div {
 	 */
 	public static function validEmail($email) {
 			// enforce maximum length to prevent libpcre recursion crash bug #52929 in PHP
-			// fixed in PHP 5.2+ later than Sept 2010; length restriction per SMTP RFC 2821
+			// fixed in PHP 5.3.4; length restriction per SMTP RFC 2821
 		if (strlen($email) > 320) {
 			return FALSE;
 		}
@@ -1535,7 +1535,7 @@ final class t3lib_div {
 					// CAPICOM not installed
 				}
 			}
-			if ($output === '' && version_compare(PHP_VERSION, '5.3.0', '>=')) {
+			if ($output === '') {
 				if (function_exists('mcrypt_create_iv')) {
 					$output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
 				} elseif (function_exists('openssl_random_pseudo_bytes')) {
@@ -3378,22 +3378,7 @@ final class t3lib_div {
 	 * @author Ingo Renner <ingo@typo3.org>
 	 */
 	public static function getMaximumPathLength() {
-		$maximumPathLength = 0;
-
-		if (version_compare(PHP_VERSION, '5.3.0', '<')) {
-				// rough assumptions
-			if (TYPO3_OS == 'WIN') {
-					// WIN is usually 255, Vista 260, although NTFS can hold about 2k
-				$maximumPathLength = 255;
-			} else {
-				$maximumPathLength = 2048;
-			}
-		} else {
-				// precise information is available since PHP 5.3
-			$maximumPathLength = PHP_MAXPATHLEN;
-		}
-
-		return $maximumPathLength;
+		return PHP_MAXPATHLEN;
 	}
 
 
diff --git a/t3lib/class.t3lib_superadmin.php b/t3lib/class.t3lib_superadmin.php
index 78a4b00988fc..b90807a47082 100644
--- a/t3lib/class.t3lib_superadmin.php
+++ b/t3lib/class.t3lib_superadmin.php
@@ -91,11 +91,7 @@
 	// *******************************
 	// Set error reporting
 	// *******************************
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 define('TYPO3_mainDir', 'typo3/'); // This is the directory of the backend administration for the sites of this TYPO3 installation.
 
diff --git a/t3lib/thumbs.php b/t3lib/thumbs.php
index 0ebbca8473ea..f138a86ebebe 100644
--- a/t3lib/thumbs.php
+++ b/t3lib/thumbs.php
@@ -54,11 +54,7 @@
 // *******************************
 // Set error reporting
 // *******************************
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 
 
diff --git a/typo3/init.php b/typo3/init.php
index 393176b1f838..c911be39d59d 100644
--- a/typo3/init.php
+++ b/typo3/init.php
@@ -59,17 +59,13 @@
 // *******************************
 // Checking PHP version
 // *******************************
-if (version_compare(phpversion(), '5.2', '<'))	die ('TYPO3 requires PHP 5.2.0 or higher.');
+if (version_compare(phpversion(), '5.3', '<'))	die ('TYPO3 requires PHP 5.3.0 or higher.');
 
 
 // *******************************
 // Set error reporting
 // *******************************
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 // *******************************
 // Prevent any unwanted output that may corrupt AJAX/compression. Note: this does
diff --git a/typo3/install/index.php b/typo3/install/index.php
index a9f348b3146d..32a81de2a287 100755
--- a/typo3/install/index.php
+++ b/typo3/install/index.php
@@ -38,11 +38,7 @@
 // Insert some security here, if you don't trust the Install Tool Password:
 // **************************************************************************
 
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 $PATH_thisScript = str_replace('//', '/', str_replace('\\', '/',
 	(PHP_SAPI == 'fpm-fcgi' || PHP_SAPI == 'cgi' || PHP_SAPI == 'isapi' || PHP_SAPI == 'cgi-fcgi') &&
diff --git a/typo3/sysext/cms/tslib/index_ts.php b/typo3/sysext/cms/tslib/index_ts.php
index 9aa7600a929e..1554cc4f74ed 100644
--- a/typo3/sysext/cms/tslib/index_ts.php
+++ b/typo3/sysext/cms/tslib/index_ts.php
@@ -45,11 +45,7 @@ if (version_compare(phpversion(), '5.2', '<'))	die ('TYPO3 requires PHP 5.2.0 or
 // *******************************
 // Set error reporting
 // *******************************
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 
 // ******************
diff --git a/typo3/sysext/cms/tslib/showpic.php b/typo3/sysext/cms/tslib/showpic.php
index ace495334fe5..aead69e4432a 100644
--- a/typo3/sysext/cms/tslib/showpic.php
+++ b/typo3/sysext/cms/tslib/showpic.php
@@ -53,11 +53,7 @@
 // *******************************
 // Set error reporting
 // *******************************
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 
 // ***********************
diff --git a/typo3/sysext/install/mod/class.tx_install_ajax.php b/typo3/sysext/install/mod/class.tx_install_ajax.php
index 531a373efd7d..b9177a11fc9d 100644
--- a/typo3/sysext/install/mod/class.tx_install_ajax.php
+++ b/typo3/sysext/install/mod/class.tx_install_ajax.php
@@ -30,11 +30,7 @@
 // *******************************
 // Set error reporting
 // *******************************
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 
 // ***********************
diff --git a/typo3/thumbs.php b/typo3/thumbs.php
index acc4fb388384..24f7e99fef9f 100644
--- a/typo3/thumbs.php
+++ b/typo3/thumbs.php
@@ -33,11 +33,7 @@
 // *******************************
 // Set error reporting
 // *******************************
-if (defined('E_DEPRECATED')) {
-	error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
-} else {
-	error_reporting(E_ALL ^ E_NOTICE);
-}
+error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
 
 
 define('PATH_thisScript', str_replace('//', '/', str_replace('\\', '/',
-- 
GitLab