From 0e7cec5eceafa9ae59487fd524435c09ec110d74 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Haso=C5=88?= Date: Fri, 10 Oct 2014 12:23:53 +0200 Subject: [PATCH] Fixed resetting debug info in compiler --- lib/Twig/Compiler.php | 1 + .../Fixtures/regression/combined_debug_info.test | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 0 deletions(-) create mode 100644 test/Twig/Tests/Fixtures/regression/combined_debug_info.test diff --git a/lib/Twig/Compiler.php b/lib/Twig/Compiler.php index 2a492b7..93dc876 100644 --- a/lib/Twig/Compiler.php +++ b/lib/Twig/Compiler.php @@ -74,6 +74,7 @@ class Twig_Compiler implements Twig_CompilerInterface { $this->lastLine = null; $this->source = ''; + $this->debugInfo = array(); $this->sourceOffset = 0; // source code starts at 1 (as we then increment it when we encounter new lines) $this->sourceLine = 1; diff --git a/test/Twig/Tests/Fixtures/regression/combined_debug_info.test b/test/Twig/Tests/Fixtures/regression/combined_debug_info.test new file mode 100644 index 0000000..df48578 --- /dev/null +++ b/test/Twig/Tests/Fixtures/regression/combined_debug_info.test @@ -0,0 +1,15 @@ +--TEST-- +Exception with bad line number +--TEMPLATE-- +{% block content %} + {{ foo }} + {{ include("foo") }} +{% endblock %} +index +--TEMPLATE(foo)-- +foo +{{ foo.bar }} +--DATA-- +return array('foo' => 'foo'); +--EXCEPTION-- +Twig_Error_Runtime: Impossible to access an attribute ("bar") on a string variable ("foo") in "foo" at line 3 -- 1.7.2.5