diff --git a/run-tests.php b/run-tests.php index 26ac65b9372..ad784fbc25e 100755 --- a/run-tests.php +++ b/run-tests.php @@ -59,11 +59,26 @@ NO_PROC_OPEN_ERROR; exit; } -// __DIR__ is available from 5.3.0 +// Version constants only available as of 5.2.8 +if (!defined("PHP_VERSION_ID")) { + list($major, $minor, $bug) = explode(".", phpversion(), 3); + $bug = (int)$bug; // Many distros make up their own versions + if ($bug < 10) { + $bug = "0$bug"; + } + + define("PHP_VERSION_ID", "{$major}0{$minor}$bug"); + define("PHP_MAJOR_VERSION", $major); +} + +// __DIR__ and FILE_BINARY is available from 5.3.0 if (PHP_VERSION_ID < 50300) { define('__DIR__', realpath(dirname(__FILE__))); + define('FILE_BINARY', 0); } + + // If timezone is not set, use UTC. if (ini_get('date.timezone') == '') { date_default_timezone_set('UTC');