aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2017-05-31 20:20:43 +0200
committerMarc Alexander <admin@m-a-styles.de>2017-05-31 20:20:43 +0200
commita079c5fed0513ddd9e66d89391067312812ab3b2 (patch)
tree01ba919bc7b970a4201aa60fad8b9fc7f3c2ed07 /phpBB/phpbb/template/twig/lexer.php
parentMerge branch '3.1.x' into 3.2.x (diff)
parent[ticket/15178] Run update again (diff)
downloadphpbb-a079c5fed0513ddd9e66d89391067312812ab3b2.tar.gz
phpbb-a079c5fed0513ddd9e66d89391067312812ab3b2.tar.bz2
phpbb-a079c5fed0513ddd9e66d89391067312812ab3b2.zip
Merge branch 'ticket/15178' into ticket/15179
Diffstat (limited to 'phpBB/phpbb/template/twig/lexer.php')
-rw-r--r--phpBB/phpbb/template/twig/lexer.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index f1542109a4..d0bcfa615e 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -22,6 +22,14 @@ class lexer extends \Twig_Lexer
public function tokenize($code, $filename = null)
{
+ // Handle \Twig_Source format input
+ if ($code instanceof \Twig_Source)
+ {
+ $source = $code;
+ $code = $source->getCode();
+ $filename = $source->getName();
+ }
+
// Our phpBB tags
// Commented out tokens are handled separately from the main replace
$phpbb_tags = array(
@@ -125,7 +133,8 @@ class lexer extends \Twig_Lexer
// Appends any filters
$code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code);
- return parent::tokenize($code, $filename);
+ // Tokenize \Twig_Source instance
+ return parent::tokenize(new \Twig_Source($code, $filename));
}
/**