- bugfix plugins may not be loaded when setMergeCompiledIncludes is true https://github.com/smarty-php/smarty/issues/435

This commit is contained in:
Uwe Tews
2018-05-17 04:40:58 +02:00
parent cb59fc5537
commit 115e178884
4 changed files with 10 additions and 8 deletions

View File

@@ -1,4 +1,7 @@
===== 3.1.33-dev-1 ===== ===== 3.1.33-dev-2 =====
17.05.2018
- bugfix plugins may not be loaded when setMergeCompiledIncludes is true https://github.com/smarty-php/smarty/issues/435
26.04.2018 26.04.2018
- bugfix regarding Security Vulnerability did not solve the problem under Linux. - bugfix regarding Security Vulnerability did not solve the problem under Linux.

View File

@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.33-dev-1'; const SMARTY_VERSION = '3.1.33-dev-2';
/** /**
* define variable scopes * define variable scopes
*/ */
@@ -1011,7 +1011,7 @@ class Smarty extends Smarty_Internal_TemplateBase
Smarty_Internal_Template $template = null) Smarty_Internal_Template $template = null)
{ {
$template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" : $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
$template_name; $template_name;
$cache_id = $cache_id === null ? $this->cache_id : $cache_id; $cache_id = $cache_id === null ? $this->cache_id : $cache_id;
$compile_id = $compile_id === null ? $this->compile_id : $compile_id; $compile_id = $compile_id === null ? $this->compile_id : $compile_id;
$caching = (int)($caching === null ? $this->caching : $caching); $caching = (int)($caching === null ? $this->caching : $caching);
@@ -1044,7 +1044,7 @@ class Smarty extends Smarty_Internal_TemplateBase
{ {
$nds = array('/' => '\\', '\\' => '/'); $nds = array('/' => '\\', '\\' => '/');
// normalize DIRECTORY_SEPARATOR // normalize DIRECTORY_SEPARATOR
$path = str_replace(array($nds[DIRECTORY_SEPARATOR], DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR, $path); //$path = str_replace(array($nds[DIRECTORY_SEPARATOR], DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR, $path);
preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u', preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
$path, $path,
$parts); $parts);

View File

@@ -58,10 +58,6 @@ class Smarty_Internal_Runtime_CodeFrame
var_export($_template->smarty->ext->_tplFunction->getTplFunction($_template), true) . ");\n"; var_export($_template->smarty->ext->_tplFunction->getTplFunction($_template), true) . ");\n";
} }
// include code for required plugins
if (!$cache && isset($compiler)) {
$output .= $compiler->compileRequiredPlugins();
}
$output .= "?>"; $output .= "?>";
$output .= $content; $output .= $content;
$output .= "<?php }\n?>"; $output .= "<?php }\n?>";

View File

@@ -421,6 +421,9 @@ abstract class Smarty_Internal_TemplateCompilerBase
$_content = $this->template->source->getContent(); $_content = $this->template->source->getContent();
} }
$_compiled_code = $this->postFilter($this->doCompile($this->preFilter($_content), true)); $_compiled_code = $this->postFilter($this->doCompile($this->preFilter($_content), true));
if (!empty($this->required_plugins[ 'compiled' ]) || !empty($this->required_plugins[ 'nocache' ])) {
$_compiled_code = '<?php ' . $this->compileRequiredPlugins() . "?>\n" . $_compiled_code;
}
} }
catch (Exception $e) { catch (Exception $e) {
if ($this->smarty->debugging) { if ($this->smarty->debugging) {