mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
removed template source code for generated template classes when debug is disabled
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
* 1.26.1 (2016-XX-XX)
|
* 1.26.1 (2016-XX-XX)
|
||||||
|
|
||||||
|
* removed template source code from generated template classes when debug is disabled
|
||||||
* fixed default implementation of Twig_Template::getDebugInfo() for better BC
|
* fixed default implementation of Twig_Template::getDebugInfo() for better BC
|
||||||
* fixed regression on static calls for functions/filters/tests
|
* fixed regression on static calls for functions/filters/tests
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -136,7 +136,7 @@ class Twig_Lexer implements Twig_LexerInterface
|
|||||||
mb_internal_encoding($mbEncoding);
|
mb_internal_encoding($mbEncoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Twig_TokenStream($this->tokens, $this->filename, $code);
|
return new Twig_TokenStream($this->tokens, $this->filename, $this->env->isDebug() ? $code : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function lexData()
|
protected function lexData()
|
||||||
|
|||||||
@@ -10,6 +10,18 @@
|
|||||||
*/
|
*/
|
||||||
class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
public function testStreamSource()
|
||||||
|
{
|
||||||
|
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
||||||
|
$lexer = new Twig_Lexer($env);
|
||||||
|
|
||||||
|
$env->disableDebug();
|
||||||
|
$this->assertSame('', $lexer->tokenize('foo')->getSource());
|
||||||
|
|
||||||
|
$env->enableDebug();
|
||||||
|
$this->assertSame('foo', $lexer->tokenize('foo')->getSource());
|
||||||
|
}
|
||||||
|
|
||||||
public function testNameLabelForTag()
|
public function testNameLabelForTag()
|
||||||
{
|
{
|
||||||
$template = '{% § %}';
|
$template = '{% § %}';
|
||||||
|
|||||||
Reference in New Issue
Block a user