bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189)

This commit is contained in:
Uwe.Tews@googlemail.com
2014-04-19 11:42:11 +00:00
parent d6c1482996
commit 8658b04c86
3 changed files with 826 additions and 824 deletions

View File

@@ -1,4 +1,6 @@
===== 3.1.19-dev ===== (xx.xx.2014) ===== 3.1.19-dev ===== (xx.xx.2014)
19.04.2014
- bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189)
18.04.2014 18.04.2014
- revert bugfix of 5.4.2015 because %-e date format is not supported on all operating systems - revert bugfix of 5.4.2015 because %-e date format is not supported on all operating systems

View File

@@ -1220,11 +1220,11 @@ class Smarty extends Smarty_Internal_TemplateBase
*/ */
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true) public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
{ {
if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) { if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
$parent = $cache_id; $parent = $cache_id;
$cache_id = null; $cache_id = null;
} }
if (!empty($parent) && is_array($parent)) { if ($parent !== null && is_array($parent)) {
$data = $parent; $data = $parent;
$parent = null; $parent = null;
} else { } else {

View File

@@ -34,7 +34,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
if ($template === null && $this instanceof $this->template_class) { if ($template === null && $this instanceof $this->template_class) {
$template = $this; $template = $this;
} }
if (!empty($cache_id) && is_object($cache_id)) { if ($cache_id !== null && is_object($cache_id)) {
$parent = $cache_id; $parent = $cache_id;
$cache_id = null; $cache_id = null;
} }