aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template/twig/tokenparser/defineparser.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-11-09 11:14:55 -0600
committerNathan Guse <nathaniel.guse@gmail.com>2013-11-09 11:14:55 -0600
commit2e5117a71eb64c734e5738235c44ef92818ca33b (patch)
treee5a0e128b2e6a226bbf3328b7bae8fed275d4799 /phpBB/phpbb/template/twig/tokenparser/defineparser.php
parent6370970f13d58f617379da64efb1f88a522f3f03 (diff)
downloadforums-2e5117a71eb64c734e5738235c44ef92818ca33b.tar
forums-2e5117a71eb64c734e5738235c44ef92818ca33b.tar.gz
forums-2e5117a71eb64c734e5738235c44ef92818ca33b.tar.bz2
forums-2e5117a71eb64c734e5738235c44ef92818ca33b.tar.xz
forums-2e5117a71eb64c734e5738235c44ef92818ca33b.zip
[ticket/11943] Throw an exception if DEFINE is setup improperly
PHPBB3-11943
Diffstat (limited to 'phpBB/phpbb/template/twig/tokenparser/defineparser.php')
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/defineparser.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
index 21add0c17c..8484f2e81a 100644
--- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php
+++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
@@ -30,6 +30,13 @@ class defineparser extends \Twig_TokenParser
$stream->next();
$value = $this->parser->getExpressionParser()->parseExpression();
+ if ($value instanceof \Twig_Node_Expression_Name)
+ {
+ // This would happen if someone improperly formed their DEFINE syntax
+ // e.g. <!-- DEFINE $VAR = foo -->
+ throw new \Twig_Error_Syntax('Invalid DEFINE', $token->getLine(), $this->parser->getFilename());
+ }
+
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
} else {
$capture = true;