Fixed guessing a template info for exceptions

This commit is contained in:
Martin Hasoň
2014-10-10 09:58:46 +02:00
parent 9fb15e343e
commit 42cd697667
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -229,6 +229,8 @@ class Twig_Error extends Exception
while ($e = array_pop($exceptions)) { while ($e = array_pop($exceptions)) {
$traces = $e->getTrace(); $traces = $e->getTrace();
array_unshift($traces, array('file' => $e->getFile(), 'line' => $e->getLine()));
while ($trace = array_shift($traces)) { while ($trace = array_shift($traces)) {
if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) {
continue; continue;
@@ -6,4 +6,4 @@ Exception for an undefined trait
{% block bar %} {% block bar %}
{% endblock %} {% endblock %}
--EXCEPTION-- --EXCEPTION--
Twig_Error_Runtime: Block "foobar" is not defined in trait "foo" in "index.twig". Twig_Error_Runtime: Block "foobar" is not defined in trait "foo" in "index.twig" at line 2.