mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Fixed broken Twig try tag when catch has not been defined or is empty
This commit is contained in:
parent
5437d2db1a
commit
17d1786e5c
|
|
@ -12,6 +12,7 @@
|
|||
* Fixed GPM not using non-standard cache path [#3410](https://github.com/getgrav/grav/issues/3410)
|
||||
* Fixed broken `environment://` stream when it doesn't have configuration
|
||||
* Fixed `Flex Object` missing key field value when using `FolderStorage`
|
||||
* Fixed broken Twig try tag when catch has not been defined or is empty
|
||||
|
||||
# v1.7.18
|
||||
## 07/19/2021
|
||||
|
|
|
|||
|
|
@ -49,16 +49,15 @@ class TwigNodeTryCatch extends Node
|
|||
|
||||
$compiler
|
||||
->indent()
|
||||
->subcompile($this->getNode('try'));
|
||||
->subcompile($this->getNode('try'))
|
||||
->outdent()
|
||||
->write('} catch (\Exception $e) {' . "\n")
|
||||
->indent()
|
||||
->write('if (isset($context[\'grav\'][\'debugger\'])) $context[\'grav\'][\'debugger\']->addException($e);' . "\n")
|
||||
->write('$context[\'e\'] = $e;' . "\n");
|
||||
|
||||
if ($this->hasNode('catch')) {
|
||||
$compiler
|
||||
->outdent()
|
||||
->write('} catch (\Exception $e) {' . "\n")
|
||||
->indent()
|
||||
->write('if (isset($context[\'grav\'][\'debugger\'])) $context[\'grav\'][\'debugger\']->addException($e);' . "\n")
|
||||
->write('$context[\'e\'] = $e;' . "\n")
|
||||
->subcompile($this->getNode('catch'));
|
||||
$compiler->subcompile($this->getNode('catch'));
|
||||
}
|
||||
|
||||
$compiler
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user