aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFyorl <gaelreth@gmail.com>2012-07-24 11:54:46 +0100
committerFyorl <gaelreth@gmail.com>2012-07-24 11:54:46 +0100
commit47c67b6d021c6488106bb0d327600b35e08bf94b (patch)
tree1d0217ba152d5df7369773032784ffd734c5e2e7
parentd0cb5bb093d09a15f422f84e19d781a8260512a0 (diff)
downloadforums-47c67b6d021c6488106bb0d327600b35e08bf94b.tar
forums-47c67b6d021c6488106bb0d327600b35e08bf94b.tar.gz
forums-47c67b6d021c6488106bb0d327600b35e08bf94b.tar.bz2
forums-47c67b6d021c6488106bb0d327600b35e08bf94b.tar.xz
forums-47c67b6d021c6488106bb0d327600b35e08bf94b.zip
[ticket/10970] Added missing initialisations and modified the regex
Non-existent variables now become empty strings. PHPBB3-10970
-rw-r--r--phpBB/includes/template/filter.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php
index 568727be82..596b83cc75 100644
--- a/phpBB/includes/template/filter.php
+++ b/phpBB/includes/template/filter.php
@@ -375,10 +375,13 @@ class phpbb_template_filter extends php_user_filter
{
$matches = array();
$replace = array();
+ $vars = array();
+ $is_expr = true;
- preg_match_all('/{[^}]+}/', $path, $matches);
+ preg_match_all('#\{((?:' . self::REGEX_NS . '\.)*)(\$)?(' . self::REGEX_VAR . ')\}#', $path, $matches);
foreach ($matches[0] as $var_str)
{
+ $tmp_is_expr = false;
$var = $this->get_varref($var_str, $tmp_is_expr);
$is_expr = $is_expr && $tmp_is_expr;
$vars[] = "isset($var)";
@@ -387,7 +390,7 @@ class phpbb_template_filter extends php_user_filter
if (!$is_expr)
{
- return ' if (' . implode(' && ', $vars) . ") { \$_template->$include_type('" . str_replace($matches[0], $replace, $path) . "', true); }";
+ return " \$_template->$include_type('" . str_replace($matches[0], $replace, $path) . "', true);";
}
else
{