aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2013-09-12 20:51:29 -0700
committerDavid King <imkingdavid@gmail.com>2013-09-12 20:51:29 -0700
commit12ede5f2a783bbdb8dc8ba9a94b4cd1ffa750e49 (patch)
tree7a864eedaa2da42f147bedac8fbea0e5d6e1abe8 /phpBB/phpbb/template
parent484d45736304921e7225b8726de5c048b430b5bf (diff)
parent8c2f73bb09dc1fa305b59c2adabdc47fd3d5afdb (diff)
downloadforums-12ede5f2a783bbdb8dc8ba9a94b4cd1ffa750e49.tar
forums-12ede5f2a783bbdb8dc8ba9a94b4cd1ffa750e49.tar.gz
forums-12ede5f2a783bbdb8dc8ba9a94b4cd1ffa750e49.tar.bz2
forums-12ede5f2a783bbdb8dc8ba9a94b4cd1ffa750e49.tar.xz
forums-12ede5f2a783bbdb8dc8ba9a94b4cd1ffa750e49.zip
Merge pull request #1708 from EXreaction/ticket/11828
[ticket/11828] Fix greedy operators in lexer
Diffstat (limited to 'phpBB/phpbb/template')
-rw-r--r--phpBB/phpbb/template/twig/lexer.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index 7ab569313c..bd9ece57fd 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -75,7 +75,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer
// Fix tokens that may have inline variables (e.g. <!-- DEFINE $TEST = '{FOO}')
$code = $this->fix_inline_variable_tokens(array(
- 'DEFINE.+=',
+ 'DEFINE \$[a-zA-Z0-9]+ =',
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
@@ -240,7 +240,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer
return "<!-- {$matches[1]}IF{$inner}-->";
};
- return preg_replace_callback('#<!-- (ELSE)?IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
+ return preg_replace_callback('#<!-- (ELSE)?IF((.*?)[\s][\$|\.|!]([^\s]+)(.*?))-->#', $callback, $code);
}
/**
@@ -264,10 +264,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer
*/
// Replace <!-- DEFINE $NAME with {% DEFINE definition.NAME
- $code = preg_replace('#<!-- DEFINE \$(.*)-->#', '{% DEFINE $1 %}', $code);
+ $code = preg_replace('#<!-- DEFINE \$(.*?) -->#', '{% DEFINE $1 %}', $code);
// Changing UNDEFINE NAME to DEFINE NAME = null to save from creating an extra token parser/node
- $code = preg_replace('#<!-- UNDEFINE \$(.*)-->#', '{% DEFINE $1= null %}', $code);
+ $code = preg_replace('#<!-- UNDEFINE \$(.*?)-->#', '{% DEFINE $1= null %}', $code);
// Replace all of our variables, {$VARNAME}, with Twig style, {{ definition.VARNAME }}
$code = preg_replace('#{\$([a-zA-Z0-9_\.]+)}#', '{{ definition.$1 }}', $code);