com phpruntests: phpruntests: improved version-check in the start-script: src/run-tests.php

From: Date: Tue, 12 May 2009 16:05:00 +0000
Subject: com phpruntests: phpruntests: improved version-check in the start-script: src/run-tests.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66485@lists.php.net to get a copy of this message
Commit: 755d0b31cf0b9e86efbc9ba3d06d1126fd5dc6ae Author: Georg Gradwohl <g2@php.net> Tue, 12 May 2009 16:05:00 +0000 Parents: 137a354f8e27c9031bf057594f7796c1a5f27c76 Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=755d0b31cf0b9e86efbc9ba3d06d1126fd5dc6ae Log: phpruntests: improved version-check in the start-script Changed paths: M src/run-tests.php Diff: diff --git a/src/run-tests.php b/src/run-tests.php index 5d8889d..963963f 100644 --- a/src/run-tests.php +++ b/src/run-tests.php @@ -8,34 +8,13 @@ * check the version of the running php-executable and * ensure that is 5.3 or higher */ -$v = phpversion(); - -$major = substr($v, 0, 1); -$minor = substr($v, 2, 1); - -$isVersionOk = false; - -if ($major > 5) { - $isVersionOk = true; - -} elseif ($major == 5) { - - if ($minor >= 3) { - $isVersionOk = true; - } +if (version_compare(PHP_VERSION, '5.3.0RC1', '<')) { + die('This version of run-tests requires PHP 5.3RC1 or higher, you are running ' . PHP_VERSION . "\n"); } +require_once dirname(__FILE__) . '/rtAutoload.php'; -if ($isVersionOk) { - - require_once dirname(__FILE__) . '/rtAutoload.php'; - - $phpTestRun = new rtPhpTestRun($argv); - $phpTestRun->run(); - -} else { - - die("This version of run-tests requires PHP 5.3 or higher.\nYou can check your current version by executing 'php -v' from the command line.\n"); -} +$phpTestRun = new rtPhpTestRun($argv); +$phpTestRun->run(); ?>

« previous php.qa (#66485) next »