summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--change_log.txt3
-rw-r--r--libs/Smarty.class.php2
-rw-r--r--libs/sysplugins/smarty_internal_method_configload.php5
-rw-r--r--libs/sysplugins/smarty_internal_template.php22
4 files changed, 17 insertions, 15 deletions
diff --git a/change_log.txt b/change_log.txt
index 5de594bf..f9e07ccb 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -2,7 +2,8 @@
11.09.2016
- improvement {math} misleading E_USER_WARNING messages when parameter value = null https://github.com/smarty-php/smarty/issues/288
- improvement move often used code snippets into methods
-
+ - performance Smarty::configLoad() did load unneeded template source object
+
09.09.2016
- bugfix/optimization {foreach} did not execute the {foreachelse} when iterating empty objects https://github.com/smarty-php/smarty/pull/287
- bugfix {foreach} must keep the @properties when restoring a saved $item variable as the properties might be used outside {foreach} https://github.com/smarty-php/smarty/issues/267
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index a77a1daa..4d3dce71 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -114,7 +114,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
- const SMARTY_VERSION = '3.1.31-dev/17';
+ const SMARTY_VERSION = '3.1.31-dev/18';
/**
* define variable scopes
diff --git a/libs/sysplugins/smarty_internal_method_configload.php b/libs/sysplugins/smarty_internal_method_configload.php
index 2e142b79..6113eaf9 100644
--- a/libs/sysplugins/smarty_internal_method_configload.php
+++ b/libs/sysplugins/smarty_internal_method_configload.php
@@ -57,11 +57,10 @@ class Smarty_Internal_Method_ConfigLoad
public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
{
/* @var \Smarty $smarty */
- $smarty = isset($data->smarty) ? $data->smarty : $data;
+ $smarty = $data->_getSmartyObj();
/* @var \Smarty_Internal_Template $confObj */
- $confObj = new Smarty_Internal_Template($config_file, $smarty, $data);
+ $confObj = new Smarty_Internal_Template($config_file, $smarty, $data, null, null, null, null, true);
$confObj->caching = Smarty::CACHING_OFF;
- $confObj->source = Smarty_Template_Config::load($confObj);
$confObj->source->config_sections = $sections;
$confObj->source->scope = $scope;
$confObj->compiled = Smarty_Template_Compiled::load($confObj);
diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php
index bb747a82..9776016f 100644
--- a/libs/sysplugins/smarty_internal_template.php
+++ b/libs/sysplugins/smarty_internal_template.php
@@ -107,19 +107,21 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
* Some of the global Smarty settings copied to template scope
* It load the required template resources and caching plugins
*
- * @param string $template_resource template resource string
- * @param Smarty $smarty Smarty instance
- * @param \Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $_parent back pointer to parent object
- * with variables or null
- * @param mixed $_cache_id cache id or null
- * @param mixed $_compile_id compile id or null
- * @param bool $_caching use caching?
- * @param int $_cache_lifetime cache life-time in seconds
+ * @param string $template_resource template resource string
+ * @param Smarty $smarty Smarty instance
+ * @param null|\Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $_parent back pointer to parent object
+ * with variables or null
+ * @param mixed $_cache_id cache id or null
+ * @param mixed $_compile_id compile id or null
+ * @param bool|int|null $_caching use caching?
+ * @param int|null $_cache_lifetime cache life-time in seconds
+ * @param bool $_isConfig
*
* @throws \SmartyException
*/
public function __construct($template_resource, Smarty $smarty, Smarty_Internal_Data $_parent = null,
- $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null)
+ $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null,
+ $_isConfig = false)
{
$this->smarty = $smarty;
// Smarty parameter
@@ -133,7 +135,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
$this->parent = $_parent;
// Template resource
$this->template_resource = $template_resource;
- $this->source = Smarty_Template_Source::load($this);
+ $this->source = $_isConfig ? Smarty_Template_Config::load($this) : Smarty_Template_Source::load($this);
parent::__construct();
if ($smarty->security_policy && method_exists($smarty->security_policy, 'registerCallBacks')) {
$smarty->security_policy->registerCallBacks($this);