diff --git a/Smarty.class.php b/Smarty.class.php index 51652477..e88683e5 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -1226,15 +1226,21 @@ function _generate_debug_output() { $_file_path = str_replace('//', '/' ,$_config_dir . '/' . $file); // get path to compiled object file - $_compile_file = $this->_get_auto_filename($this->compile_dir, $file . $section, 'SMARTY_CONFIG'); + if(isset($section)) { + $_compile_file = $this->_get_auto_filename($this->compile_dir, $section . ' ' . $file); + } else { + $_compile_file = $this->_get_auto_filename($this->compile_dir, $file); + } // need to generate cache? - if($this->force_compile || - ($this->compile_check && ( @filemtime($_compile_file) != @filemtime($_file_path) ))) { + if($this->force_compile || !file_exists($_compile_file) || + ($this->compile_check && + file_exists($_file_path) && + ( filemtime($_compile_file) != filemtime($_file_path) ))) { $_generate_cache = true; } else { include($_compile_file); - if(empty($_config_vars)) { + if(!empty($_config_vars)) { $_generate_cache = true; } else { $_generate_cache = false; @@ -1254,9 +1260,9 @@ function _generate_debug_output() { if($_config_vars = $this->_conf_obj->get($file, $section)) { if(function_exists('var_export')) { - $_compile_data = ''; + $_compile_data = ''; } else { - $_compile_data = ''; + $_compile_data = ''; } $this->_write_file($_compile_file, $_compile_data, true); touch($_compile_file,filemtime($_file_path)); diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index a58e8f2a..ccda17e4 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -542,23 +542,21 @@ class Smarty_Compiler extends Smarty { $attrs['section'] = 'null'; } - $scope = @$this->_dequote($attrs['scope']); - if (!empty($scope)) { + if (isset($attrs['scope'])) { + $scope = @$this->_dequote($attrs['scope']); if ($scope != 'local' && $scope != 'parent' && $scope != 'global') { $this->_syntax_error("invalid 'scope' attribute value"); } } else { - if (!empty($attrs['global']) && $attrs['global']) + if (isset($attrs['global']) && $attrs['global']) $scope = 'parent'; else $scope = 'local'; } - $output = 'config_load(' . $attrs['file'] . ', ' . $attrs['section'] . ", '$scope'); ?>"; - - return $output; + return 'config_load(' . $attrs['file'] . ', ' . $attrs['section'] . ", '$scope'); ?>"; } diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 51652477..e88683e5 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1226,15 +1226,21 @@ function _generate_debug_output() { $_file_path = str_replace('//', '/' ,$_config_dir . '/' . $file); // get path to compiled object file - $_compile_file = $this->_get_auto_filename($this->compile_dir, $file . $section, 'SMARTY_CONFIG'); + if(isset($section)) { + $_compile_file = $this->_get_auto_filename($this->compile_dir, $section . ' ' . $file); + } else { + $_compile_file = $this->_get_auto_filename($this->compile_dir, $file); + } // need to generate cache? - if($this->force_compile || - ($this->compile_check && ( @filemtime($_compile_file) != @filemtime($_file_path) ))) { + if($this->force_compile || !file_exists($_compile_file) || + ($this->compile_check && + file_exists($_file_path) && + ( filemtime($_compile_file) != filemtime($_file_path) ))) { $_generate_cache = true; } else { include($_compile_file); - if(empty($_config_vars)) { + if(!empty($_config_vars)) { $_generate_cache = true; } else { $_generate_cache = false; @@ -1254,9 +1260,9 @@ function _generate_debug_output() { if($_config_vars = $this->_conf_obj->get($file, $section)) { if(function_exists('var_export')) { - $_compile_data = ''; + $_compile_data = ''; } else { - $_compile_data = ''; + $_compile_data = ''; } $this->_write_file($_compile_file, $_compile_data, true); touch($_compile_file,filemtime($_file_path)); diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index a58e8f2a..ccda17e4 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -542,23 +542,21 @@ class Smarty_Compiler extends Smarty { $attrs['section'] = 'null'; } - $scope = @$this->_dequote($attrs['scope']); - if (!empty($scope)) { + if (isset($attrs['scope'])) { + $scope = @$this->_dequote($attrs['scope']); if ($scope != 'local' && $scope != 'parent' && $scope != 'global') { $this->_syntax_error("invalid 'scope' attribute value"); } } else { - if (!empty($attrs['global']) && $attrs['global']) + if (isset($attrs['global']) && $attrs['global']) $scope = 'parent'; else $scope = 'local'; } - $output = 'config_load(' . $attrs['file'] . ', ' . $attrs['section'] . ", '$scope'); ?>"; - - return $output; + return 'config_load(' . $attrs['file'] . ', ' . $attrs['section'] . ", '$scope'); ?>"; }