aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template/twig/tokenparser/defineparser.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/template/twig/tokenparser/defineparser.php')
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/defineparser.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
index 688afec191..8484f2e81a 100644
--- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php
+++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
@@ -9,14 +9,6 @@
namespace phpbb\template\twig\tokenparser;
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
class defineparser extends \Twig_TokenParser
{
@@ -38,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;