Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed resetting debug info in compiler
  • Loading branch information
hason committed Oct 10, 2014
1 parent 9fb15e3 commit 0e7cec5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Twig/Compiler.php
Expand Up @@ -74,6 +74,7 @@ public function compile(Twig_NodeInterface $node, $indentation = 0)
{
$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;
Expand Down
15 changes: 15 additions & 0 deletions 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

0 comments on commit 0e7cec5

Please sign in to comment.