From c1ed53da6c51e676bb023d7d469c2b53ac231f9c Mon Sep 17 00:00:00 2001 From: Reedy Date: Sat, 5 May 2012 00:10:51 +0100 Subject: [PATCH] Kill off pre php 5.3.2 back compat hacks Change-Id: I5b806a5d8fd4ec6914e3786a4a9aefba4ad6faa6 --- includes/GlobalFunctions.php | 15 ++----------- tests/selenium/SeleniumConfig.php | 36 +------------------------------ 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 74b2ea6b1e..70865cb2f2 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2761,9 +2761,7 @@ function wfDl( $extension, $fileName = null ) { $canDl = false; $sapi = php_sapi_name(); - if( version_compare( PHP_VERSION, '5.3.0', '<' ) || - $sapi == 'cli' || $sapi == 'cgi' || $sapi == 'embed' ) - { + if( $sapi == 'cli' || $sapi == 'cgi' || $sapi == 'embed' ) { $canDl = ( function_exists( 'dl' ) && is_callable( 'dl' ) && wfIniGetBool( 'enable_dl' ) && !wfIniGetBool( 'safe_mode' ) ); } @@ -2901,16 +2899,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array() ) { } $cmd = $envcmd . $cmd; - if ( wfIsWindows() ) { - if ( version_compare( PHP_VERSION, '5.3.0', '<' ) && /* Fixed in 5.3.0 :) */ - ( version_compare( PHP_VERSION, '5.2.1', '>=' ) || php_uname( 's' ) == 'Windows NT' ) ) - { - # Hack to work around PHP's flawed invocation of cmd.exe - # http://news.php.net/php.internals/21796 - # Windows 9x doesn't accept any kind of quotes - $cmd = '"' . $cmd . '"'; - } - } elseif ( php_uname( 's' ) == 'Linux' ) { + if ( php_uname( 's' ) == 'Linux' ) { $time = intval( $wgMaxShellTime ); $mem = intval( $wgMaxShellMemory ); $filesize = intval( $wgMaxShellFileSize ); diff --git a/tests/selenium/SeleniumConfig.php b/tests/selenium/SeleniumConfig.php index b148715454..04cf8d8857 100644 --- a/tests/selenium/SeleniumConfig.php +++ b/tests/selenium/SeleniumConfig.php @@ -24,12 +24,7 @@ class SeleniumConfig { throw new MWException( "Unable to read local Selenium Settings from " . $seleniumConfigFile . "\n" ); } - if ( !defined( 'PHP_VERSION_ID' ) || - ( PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3 ) ) { - $configArray = self::parse_5_2_ini_file( $seleniumConfigFile ); - } else { - $configArray = parse_ini_file( $seleniumConfigFile, true ); - } + $configArray = parse_ini_file( $seleniumConfigFile, true ); if ( $configArray === false ) { throw new MWException( "Error parsing " . $seleniumConfigFile . "\n" ); } @@ -61,35 +56,6 @@ class SeleniumConfig { return true; } - /** - * PHP 5.2 parse_ini_file() doesn't have support for array keys. - * This function parses simple ini files with such syntax using just - * 5.2 functions. - */ - private static function parse_5_2_ini_file( $ConfigFile ) { - $file = fopen( $ConfigFile, "rt" ); - if ( !$file ) { - return false; - } - $header = ''; - - $configArray = array(); - - while ( ( $line = fgets( $file ) ) !== false ) { - $line = strtok( $line, "\r\n" ); - - if ( !$line || $line[0] == ';' ) continue; - - if ( $line[0] == '[' && substr( $line, -1 ) == ']' ) { - $header = substr( $line, 1, -1 ); - $configArray[$header] = array(); - } else { - $configArray[$header] = array_merge_recursive( $configArray[$header], self::parse_ini_line( $line ) ); - } - } - return $configArray; - } - private static function parse_ini_line( $iniLine ) { static $specialValues = array( 'false' => false, 'true' => true, 'null' => null ); list( $key, $value ) = explode( '=', $iniLine, 2 ); -- 2.20.1