]> granicus.if.org Git - php/commitdiff
Make it possible to run on PHP5.2
authorHannes Magnusson <bjori@php.net>
Thu, 16 Apr 2009 13:40:47 +0000 (13:40 +0000)
committerHannes Magnusson <bjori@php.net>
Thu, 16 Apr 2009 13:40:47 +0000 (13:40 +0000)
run-tests.php

index 26ac65b9372de185e36fa2f0d8ad22b27b682bc8..ad784fbc25e317d997c95003e3241d43713b0721 100755 (executable)
@@ -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');