Fixed fatal error in CompiledFile if the cached version is broken

This commit is contained in:
Matias Griese
2020-11-12 13:35:36 +02:00
parent a9e6d3665f
commit e92d88df8b
2 changed files with 7 additions and 2 deletions

View File

@@ -27,6 +27,7 @@
* Fixed `header.admin.children_display_order` in Flex Pages to work just like with regular pages
* Fixed `Utils::isFunctionDisabled()` method if there are spaces in `disable_functions` [#3023](https://github.com/getgrav/grav/issues/3023)
* Fixed potential fatal error when creating flex index using cache [#3062](https://github.com/getgrav/grav/issues/3062)
* Fixed fatal error in `CompiledFile` if the cached version is broken
# v1.7.0-rc.17
## 10/07/2020

View File

@@ -12,6 +12,7 @@ namespace Grav\Common\File;
use Exception;
use RocketTheme\Toolbox\File\PhpFile;
use RuntimeException;
use Throwable;
use function function_exists;
use function get_class;
@@ -36,9 +37,12 @@ trait CompiledFile
$file = PhpFile::instance(CACHE_DIR . "compiled/files/{$key}{$this->extension}.php");
$modified = $this->modified();
if (!$modified) {
return $this->decode($this->raw());
try {
return $this->decode($this->raw());
} catch (Throwable $e) {
// If the compiled file is broken, we can safely ignore the error and continue.
}
}
$class = get_class($this);