From 42cd697667492e9d4c61f268992dbe37f6dad1dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Haso=C5=88?= Date: Fri, 10 Oct 2014 09:58:46 +0200 Subject: [PATCH] Fixed guessing a template info for exceptions --- lib/Twig/Error.php | 2 ++ .../Tests/Fixtures/exceptions/undefined_trait.test | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/lib/Twig/Error.php b/lib/Twig/Error.php index 6772887..5b253dd 100644 --- a/lib/Twig/Error.php +++ b/lib/Twig/Error.php @@ -229,6 +229,8 @@ class Twig_Error extends Exception while ($e = array_pop($exceptions)) { $traces = $e->getTrace(); + array_unshift($traces, array('file' => $e->getFile(), 'line' => $e->getLine())); + while ($trace = array_shift($traces)) { if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { continue; diff --git a/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test b/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test index 026bd52..6679fbe 100644 --- a/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test +++ b/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test @@ -6,4 +6,4 @@ Exception for an undefined trait {% block bar %} {% endblock %} --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. -- 1.7.2.5