From e2cc55a4e3294d5855d27c7a1ca3daa5d9a99185 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 16 Feb 2017 10:16:30 +0100 Subject: [PATCH] Fix syntax error in PHP 5.3. Move the version check before requiring the autoloaded deps --- CHANGELOG.md | 3 ++- index.php | 9 +++++---- system/defines.php | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93aa4783c..334174275 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#bugfix) * Fix for double extensions getting added during some redirects [#1307](https://github.com/getgrav/grav/issues/1307) + * Fix syntax error in PHP 5.3. Move the version check before requiring the autoloaded deps # v1.1.16 ## 02/10/2017 @@ -17,7 +18,7 @@ * Various code cleanups (return types, missing variables in doclbocks, etc.) 1. [](#bugfix) * Fix blueprints slug validation [https://github.com/getgrav/grav-plugin-admin/issues/955](https://github.com/getgrav/grav-plugin-admin/issues/955) - + # v1.1.15 ## 01/30/2017 diff --git a/index.php b/index.php index 8d8d2b62f..b7a100134 100644 --- a/index.php +++ b/index.php @@ -7,6 +7,7 @@ */ namespace Grav; +define('GRAV_PHP_MIN', '5.5.9'); // Ensure vendor libraries exist $autoload = __DIR__ . '/vendor/autoload.php'; @@ -23,13 +24,13 @@ if (PHP_SAPI == 'cli-server') { use Grav\Common\Grav; use RocketTheme\Toolbox\Event\Event; -// Register the auto-loader. -$loader = require_once $autoload; - if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) { die(sprintf('You are running PHP %s, but Grav needs at least PHP %s to run.', $ver, $req)); } +// Register the auto-loader. +$loader = require_once $autoload; + // Set timezone to default, falls back to system if php.ini not set date_default_timezone_set(@date_default_timezone_get()); @@ -50,6 +51,6 @@ $grav = Grav::instance( try { $grav->process(); } catch (\Exception $e) { - $grav->fireEvent('onFatalException', new Event(['exception' => $e])); + $grav->fireEvent('onFatalException', new Event(array('exception' => $e))); throw $e; } diff --git a/system/defines.php b/system/defines.php index d033a98d8..9f2975723 100644 --- a/system/defines.php +++ b/system/defines.php @@ -11,7 +11,6 @@ define('GRAV', true); define('GRAV_VERSION', '1.1.16'); define('GRAV_TESTING', false); define('DS', '/'); -define('GRAV_PHP_MIN', '5.5.9'); // Directories and Paths if (!defined('GRAV_ROOT')) {