From a4334bbef56fe9360741fda2bee100ac1e8aebed Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 9 Jul 2014 16:46:35 -0700 Subject: [PATCH] Use PHP_VERSION constant instead of phpversion() function call Change-Id: Ifb3d1bd92d6abaa561e7337b311b4cb10c38a2b6 --- api.php | 2 +- includes/PHPVersionError.php | 2 +- includes/api/ApiQuerySiteinfo.php | 2 +- includes/installer/Installer.php | 2 +- index.php | 2 +- load.php | 2 +- maintenance/install.php | 2 +- maintenance/update.php | 2 +- mw-config/index.php | 2 +- tests/testHelpers.inc | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api.php b/api.php index e55ec75a33..e8a911e3a1 100644 --- a/api.php +++ b/api.php @@ -34,7 +34,7 @@ define( 'MW_API', true ); // Bail if PHP is too low -if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) { +if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) { // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ require dirname( __FILE__ ) . '/includes/PHPVersionError.php'; wfPHPVersionError( 'api.php' ); diff --git a/includes/PHPVersionError.php b/includes/PHPVersionError.php index e475f0b862..0f5a6fc087 100644 --- a/includes/PHPVersionError.php +++ b/includes/PHPVersionError.php @@ -42,7 +42,7 @@ function wfPHPVersionError( $type ) { $mwVersion = '1.24'; $minimumVersionPHP = '5.3.2'; - $phpVersion = phpversion(); + $phpVersion = PHP_VERSION; $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'; $message = "MediaWiki $mwVersion requires at least " . "PHP version $minimumVersionPHP, you are using PHP $phpVersion."; diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index aacf091756..089ce04815 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -136,7 +136,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { $data['generator'] = "MediaWiki {$config->get( 'Version' )}"; - $data['phpversion'] = phpversion(); + $data['phpversion'] = PHP_VERSION; $data['phpsapi'] = PHP_SAPI; $data['dbtype'] = $config->get( 'DBtype' ); $data['dbversion'] = $this->getDB()->getServerVersion(); diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 86b975ee83..4f40693479 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -417,7 +417,7 @@ abstract class Installer { public function doEnvironmentChecks() { // Php version has already been checked by entry scripts // Show message here for information purposes - $this->showMessage( 'config-env-php', phpversion() ); + $this->showMessage( 'config-env-php', PHP_VERSION ); $good = true; // Must go here because an old version of PCRE can prevent other checks from completing diff --git a/index.php b/index.php index bc46111bd4..b35967b325 100644 --- a/index.php +++ b/index.php @@ -34,7 +34,7 @@ # has structures (try/catch, foo()->bar(), etc etc) which throw parse errors in # PHP 4. Setup.php and ObjectCache.php have structures invalid in PHP 5.0 and # 5.1, respectively. -if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) { +if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) { // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ require dirname( __FILE__ ) . '/includes/PHPVersionError.php'; wfPHPVersionError( 'index.php' ); diff --git a/load.php b/load.php index 1790f4833d..1dd1a8939c 100644 --- a/load.php +++ b/load.php @@ -23,7 +23,7 @@ */ // Bail if PHP is too low -if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) { +if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) { // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ require dirname( __FILE__ ) . '/includes/PHPVersionError.php'; wfPHPVersionError( 'load.php' ); diff --git a/maintenance/install.php b/maintenance/install.php index fbc5d9815f..3b2945225c 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.3.2' ) < 0 ) ) { +if ( !function_exists( 'version_compare' ) || ( version_compare( PHP_VERSION, '5.3.2' ) < 0 ) ) { require_once dirname( __FILE__ ) . '/../includes/PHPVersionError.php'; wfPHPVersionError( 'cli' ); } diff --git a/maintenance/update.php b/maintenance/update.php index a51564aff3..046d73cdce 100755 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -26,7 +26,7 @@ * @ingroup Maintenance */ -if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.3.2' ) < 0 ) ) { +if ( !function_exists( 'version_compare' ) || ( version_compare( PHP_VERSION, '5.3.2' ) < 0 ) ) { require dirname( __FILE__ ) . '/../includes/PHPVersionError.php'; wfPHPVersionError( 'cli' ); } diff --git a/mw-config/index.php b/mw-config/index.php index 9e83c54644..be176c7204 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -21,7 +21,7 @@ */ // Bail if PHP is too low -if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) { +if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) { // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ require dirname( dirname( __FILE__ ) ) . '/includes/PHPVersionError.php'; wfPHPVersionError( 'mw-config/index.php' ); diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index d2e7f6e31a..8c24f3981a 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -318,7 +318,7 @@ class DbTestRecorder extends DbTestPreviewer { array( 'tr_date' => $this->db->timestamp(), 'tr_mw_version' => $this->version, - 'tr_php_version' => phpversion(), + 'tr_php_version' => PHP_VERSION, 'tr_db_version' => $this->db->getServerVersion(), 'tr_uname' => php_uname() ), -- 2.20.1