From b05bc1b617a2be6444f2e56a61a74b006820a746 Mon Sep 17 00:00:00 2001 From: uwetews Date: Thu, 11 Oct 2018 09:22:23 +0200 Subject: [PATCH] - bugfix in date-format modifier; NULL at date string or default_date did not produce correct output https://github.com/smarty-php/smarty/pull/458 --- change_log.txt | 4 +++- libs/Smarty.class.php | 2 +- libs/plugins/modifier.date_format.php | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index a52d5236..cc7fede2 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,7 +2,9 @@ 11.10.2018 - bugfix {insert} not works when caching is enabled and included template is present https://github.com/smarty-php/smarty/issues/496 - + - bugfix in date-format modifier; NULL at date string or default_date did not produce correct output + https://github.com/smarty-php/smarty/pull/458 + 09.10.2018 - bugfix fix of 26.8.2017 https://github.com/smarty-php/smarty/issues/327 modifier is applied to sum expression https://github.com/smarty-php/smarty/issues/491 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index a3d62486..2565d3f6 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.34-dev-3'; + const SMARTY_VERSION = '3.1.34-dev-4'; /** * define variable scopes */ diff --git a/libs/plugins/modifier.date_format.php b/libs/plugins/modifier.date_format.php index 23b69430..c8e88c5c 100644 --- a/libs/plugins/modifier.date_format.php +++ b/libs/plugins/modifier.date_format.php @@ -41,9 +41,9 @@ function smarty_modifier_date_format($string, $format = null, $default_date = '' } $is_loaded = true; } - if ($string !== '' && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') { + if (!empty($string) && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') { $timestamp = smarty_make_timestamp($string); - } elseif ($default_date !== '') { + } elseif (!empty($default_date)) { $timestamp = smarty_make_timestamp($default_date); } else { return;