bug #1527 Fixed resetting debug info in compiler (hason)

This PR was merged into the 1.16-dev branch.

Discussion
----------

Fixed resetting debug info in compiler

Commits
-------

0e7cec5 Fixed resetting debug info in compiler
This commit is contained in:
Fabien Potencier
2014-10-10 15:38:59 +02:00
2 changed files with 16 additions and 0 deletions
+1
View File
@@ -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;
@@ -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