Merge branch 'release/1.1.17'

This commit is contained in:
Andy Miller
2017-02-17 14:57:59 -07:00
7 changed files with 63 additions and 9 deletions

View File

@@ -1,3 +1,11 @@
# v1.1.17
## 02/17/2017
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
* Fix Whoops displaying error page if there is PHP core warning or error [Admin #980](https://github.com/getgrav/grav-plugin-admin/issues/980)
# v1.1.16
## 02/10/2017

View File

@@ -146,6 +146,7 @@ Support us with a monthly donation and help us continue our activities. [[Become
# Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/grav#sponsor)]
<a href="https://opencollective.com/grav/sponsor/0/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/grav/sponsor/1/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/grav/sponsor/2/website" target="_blank"><img src="https://opencollective.com/grav/sponsor/2/avatar.svg"></a>

View File

@@ -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 <strong>PHP %s</strong> 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;
}

View File

@@ -8,10 +8,13 @@
// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.1.16');
define('GRAV_VERSION', '1.1.17');
define('GRAV_TESTING', false);
define('DS', '/');
define('GRAV_PHP_MIN', '5.5.9');
if (!defined('GRAV_PHP_MIN')) {
define('GRAV_PHP_MIN', '5.5.9');
}
// Directories and Paths
if (!defined('GRAV_ROOT')) {

View File

@@ -20,7 +20,8 @@ class Errors
$jsonRequest = $_SERVER && isset($_SERVER['HTTP_ACCEPT']) && $_SERVER['HTTP_ACCEPT'] == 'application/json';
// Setup Whoops-based error handler
$whoops = new \Whoops\Run;
$system = new SystemFacade;
$whoops = new \Whoops\Run($system);
$verbosity = 1;

View File

@@ -0,0 +1,39 @@
<?php
/**
* @package Grav.Common.Errors
*
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common\Errors;
class SystemFacade extends \Whoops\Util\SystemFacade
{
protected $whoopsShutdownHandler;
/**
* @param callable $function
*
* @return void
*/
public function registerShutdownFunction(callable $function)
{
$this->whoopsShutdownHandler = $function;
register_shutdown_function([$this, 'handleShutdown']);
}
/**
* Special case to deal with Fatal errors and the like.
*/
public function handleShutdown()
{
$error = $this->getLastError();
// Ignore core warnings and errors.
if ($error && !($error['type'] & (E_CORE_WARNING | E_CORE_ERROR))) {
$handler = $this->whoopsShutdownHandler;
$handler();
}
}
}

View File

@@ -345,9 +345,10 @@ class Pages
$page = $this->dispatch($route, $all);
} else {
// Try Regex style redirects
$uri = $this->grav['uri'];
$source_url = $url;
$extension = $this->grav['uri']->extension();
if (isset($extension)) {
$extension = $uri->extension();
if (isset($extension) && !Utils::endsWith($uri->url(), $extension)) {
$source_url.= '.' . $extension;
}