mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- improve recovery from ivalid compiled template code
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
===== 3.1.28-dev===== (xx.xx.2015)
|
===== 3.1.28-dev===== (xx.xx.2015)
|
||||||
24.10.2015
|
24.10.2015
|
||||||
- new extension handler to load functions when called
|
- new extension handler to load functions when called
|
||||||
|
- improve recovery from ivalid compiled template code
|
||||||
|
|
||||||
21.10.2015
|
21.10.2015
|
||||||
- move some code into runtime extensions
|
- move some code into runtime extensions
|
||||||
|
@@ -46,7 +46,7 @@ class Smarty_Internal_TestInstall
|
|||||||
if ($_stream_resolve_include_path) {
|
if ($_stream_resolve_include_path) {
|
||||||
$template_dir = stream_resolve_include_path($_template_dir);
|
$template_dir = stream_resolve_include_path($_template_dir);
|
||||||
} else {
|
} else {
|
||||||
$template_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_template_dir, null, $smarty);
|
$template_dir = $smarty->ext->_getIncludePath->getIncludePath($_template_dir, null, $smarty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($template_dir !== false) {
|
if ($template_dir !== false) {
|
||||||
@@ -165,7 +165,7 @@ class Smarty_Internal_TestInstall
|
|||||||
if ($_stream_resolve_include_path) {
|
if ($_stream_resolve_include_path) {
|
||||||
$plugin_dir = stream_resolve_include_path($_plugin_dir);
|
$plugin_dir = stream_resolve_include_path($_plugin_dir);
|
||||||
} else {
|
} else {
|
||||||
$plugin_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_plugin_dir, null, $smarty);
|
$plugin_dir = $smarty->ext->_getIncludePath->getIncludePath($_plugin_dir, null, $smarty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($plugin_dir !== false) {
|
if ($plugin_dir !== false) {
|
||||||
@@ -294,7 +294,7 @@ class Smarty_Internal_TestInstall
|
|||||||
if ($_stream_resolve_include_path) {
|
if ($_stream_resolve_include_path) {
|
||||||
$config_dir = stream_resolve_include_path($_config_dir);
|
$config_dir = stream_resolve_include_path($_config_dir);
|
||||||
} else {
|
} else {
|
||||||
$config_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_config_dir, null, $smarty);
|
$config_dir = $smarty->ext->_getIncludePath->getIncludePath($_config_dir, null, $smarty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config_dir !== false) {
|
if ($config_dir !== false) {
|
||||||
|
@@ -142,7 +142,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
}
|
}
|
||||||
$_template->smarty->compile_check = $compileCheck;
|
$_template->smarty->compile_check = $compileCheck;
|
||||||
} else {
|
} else {
|
||||||
include($_template->compiled->filepath);
|
$_template->mustCompile = true;
|
||||||
|
@include($_template->compiled->filepath);
|
||||||
if ($_template->mustCompile) {
|
if ($_template->mustCompile) {
|
||||||
$this->compileTemplateSource($_template);
|
$this->compileTemplateSource($_template);
|
||||||
$compileCheck = $_template->smarty->compile_check;
|
$compileCheck = $_template->smarty->compile_check;
|
||||||
@@ -155,7 +156,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
!empty($_template->parent->compiled->includes) &&
|
!empty($_template->parent->compiled->includes) &&
|
||||||
$_template->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_AUTOMATIC &&
|
$_template->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_AUTOMATIC &&
|
||||||
!$_template->source->handler->recompiled && $_template->source->type != 'string' &&
|
!$_template->source->handler->recompiled && $_template->source->type != 'string' &&
|
||||||
(!isset($_template->smarty->_cache['template_objects']) || !isset($_template->smarty->_cache['template_objects'][$_template->_getTemplateId()]))
|
(!isset($_template->smarty->_cache['template_objects']) ||
|
||||||
|
!isset($_template->smarty->_cache['template_objects'][$_template->_getTemplateId()]))
|
||||||
) {
|
) {
|
||||||
foreach ($_template->parent->compiled->includes as $key => $count) {
|
foreach ($_template->parent->compiled->includes as $key => $count) {
|
||||||
$_template->compiled->includes[$key] =
|
$_template->compiled->includes[$key] =
|
||||||
@@ -164,7 +166,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
}
|
}
|
||||||
$key = $_template->source->type . ':' . $_template->source->name;
|
$key = $_template->source->type . ':' . $_template->source->name;
|
||||||
if (isset($_template->compiled->includes[$key]) && $_template->compiled->includes[$key] > 1) {
|
if (isset($_template->compiled->includes[$key]) && $_template->compiled->includes[$key] > 1) {
|
||||||
$_template->smarty->_cache['template_objects'][isset($_template->templateId) ? $_template->templateId : $_template->_getTemplateId()] = $_template;
|
$_template->smarty->_cache['template_objects'][isset($_template->templateId) ? $_template->templateId :
|
||||||
|
$_template->_getTemplateId()] = $_template;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->processed = true;
|
$this->processed = true;
|
||||||
@@ -183,7 +186,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
}
|
}
|
||||||
$_smarty_tpl = $_template;
|
$_smarty_tpl = $_template;
|
||||||
if (strpos(phpversion(), 'hhvm') !== false) {
|
if (strpos(phpversion(), 'hhvm') !== false) {
|
||||||
Smarty_Internal_Extension_Hhvm::includeHhvm($_template, $_template->compiled->filepath);
|
$_template->smarty->ext->_hhvm->includeHhvm($_template, $_template->compiled->filepath);
|
||||||
} else {
|
} else {
|
||||||
include($_template->compiled->filepath);
|
include($_template->compiled->filepath);
|
||||||
}
|
}
|
||||||
@@ -277,8 +280,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
public function write(Smarty_Internal_Template $_template, $code)
|
public function write(Smarty_Internal_Template $_template, $code)
|
||||||
{
|
{
|
||||||
if (!$_template->source->handler->recompiled) {
|
if (!$_template->source->handler->recompiled) {
|
||||||
$obj = new Smarty_Internal_Write_File();
|
if ($_template->smarty->ext->_writeFile->writeFile($this->filepath, $code, $_template->smarty) === true) {
|
||||||
if ($obj->writeFile($this->filepath, $code, $_template->smarty) === true) {
|
|
||||||
$this->timestamp = $this->exists = is_file($this->filepath);
|
$this->timestamp = $this->exists = is_file($this->filepath);
|
||||||
if ($this->exists) {
|
if ($this->exists) {
|
||||||
$this->timestamp = filemtime($this->filepath);
|
$this->timestamp = filemtime($this->filepath);
|
||||||
|
Reference in New Issue
Block a user