Make it possible to run on PHP5.2

This commit is contained in:
Hannes Magnusson 2009-04-16 13:40:47 +00:00
parent 8906ef059d
commit a186602114

View File

@ -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');