Replace '*/' in user supplied input in C-style comments with '* /'.

This commit is contained in:
Simon Wisselink
2022-05-16 12:34:49 +02:00
parent 3f97b7352e
commit 05f1a7deda
6 changed files with 24 additions and 15 deletions

View File

@@ -44,9 +44,12 @@ class Smarty_Internal_Runtime_CodeFrame
$properties[ 'file_dependency' ] = $_template->cached->file_dependency;
$properties[ 'cache_lifetime' ] = $_template->cache_lifetime;
}
$output = "<?php\n";
$output .= "/* Smarty version {$properties[ 'version' ]}, created on " . date("Y-m-d H:i:s") .
"\n from '" . str_replace('*/', '* /', $_template->source->filepath) . "' */\n\n";
$output = sprintf(
"<?php\n/* Smarty version %s, created on %s\n from '%s' */\n\n",
$properties[ 'version' ],
date("Y-m-d H:i:s"),
str_replace('*/', '* /', $_template->source->filepath)
);
$output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n";
$dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
($cache ? 'true' : 'false') . ')';