mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 18:36:53 +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)
|
||||
|
||||
* removed template source code from generated template classes when debug is disabled
|
||||
* fixed default implementation of Twig_Template::getDebugInfo() for better BC
|
||||
* 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);
|
||||
}
|
||||
|
||||
return new Twig_TokenStream($this->tokens, $this->filename, $code);
|
||||
return new Twig_TokenStream($this->tokens, $this->filename, $this->env->isDebug() ? $code : '');
|
||||
}
|
||||
|
||||
protected function lexData()
|
||||
|
||||
@@ -10,6 +10,18 @@
|
||||
*/
|
||||
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()
|
||||
{
|
||||
$template = '{% § %}';
|
||||
|
||||
Reference in New Issue
Block a user