diff options
Diffstat (limited to 'pmwiki.php')
-rw-r--r-- | pmwiki.php | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1507,6 +1507,7 @@ function FmtGroupHome($pn,$group,$var) { ## {$$key} in $text with $vars['key']. function FmtTemplateVars($text, $vars, $pagename = NULL) { global $FmtPV, $EnableUndefinedTemplateVars; + $text = strval($text); if ($pagename) { $pat = implode('|', array_map('preg_quote', array_keys($FmtPV))); $pprc = new PPRC($pagename); @@ -1514,8 +1515,8 @@ function FmtTemplateVars($text, $vars, $pagename = NULL) { array($pprc, 'pagevar'), $text); } foreach(preg_grep('/^[\\w$]/', array_keys($vars)) as $k) - if (!is_array($vars[$k])) - $text = str_replace("{\$\$$k}", @$vars[$k], $text); + if (!is_array($vars[$k]) && $text) + $text = str_replace("{\$\$$k}", strval(@$vars[$k]), $text); if (! IsEnabled($EnableUndefinedTemplateVars, 0)) $text = preg_replace("/\\{\\$\\$\\w+\\}/", '', $text); return $text; |