Change exception to die() in order to always show a message when these fatal errors are found

As proposed by @mahagr
This commit is contained in:
Flavio Copes 2016-03-17 20:33:32 +01:00
parent 3aca86ef6f
commit 71bbb03bd9

View File

@ -1,7 +1,6 @@
<?php
namespace Grav;
// Ensure vendor libraries exist
$autoload = __DIR__ . '/vendor/autoload.php';
if (!is_file($autoload)) {
@ -14,15 +13,15 @@ use Grav\Common\Grav;
$loader = require_once $autoload;
if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
throw new \RuntimeException(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
die(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
}
// Set timezone to default, falls back to system if php.ini not set
date_default_timezone_set(@date_default_timezone_get());
// Set internal encoding if mbstring loaded
if (!extension_loaded('mbstring')) {
throw new \RuntimeException("'mbstring' extension is not loaded. This is required for Grav to run correctly");
if (extension_loaded('mbstring')) {
die("'mbstring' extension is not loaded. This is required for Grav to run correctly");
}
mb_internal_encoding('UTF-8');
@ -40,4 +39,3 @@ try {
$grav->fireEvent('onFatalException');
throw $e;
}