From a06d83bfb4986c89b915c6864bf848e55c1b6a7e Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Wed, 30 Oct 2013 20:10:37 +0100 Subject: [PATCH] Fixed exception if module content is empty --- core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php | 6 +++++- .../Tests/Core/Template/Smarty/Plugins/FormatTest.php | 1 + templates/admin/default/ajax/thelia_news_feed.html | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php index 1c6ab4fd1..23f9ed231 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php @@ -53,7 +53,11 @@ class Module extends AbstractSmartyPlugin } } } - return $template->fetch(sprintf("string:%s", $content)); + + if (! empty($content)) + return $template->fetch(sprintf("string:%s", $content)); + + return ""; } /** diff --git a/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php index 979642677..a673b805b 100644 --- a/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php @@ -155,6 +155,7 @@ class FormatTest extends \PHPUnit_Framework_TestCase * test formatDate without mandatory parameters * * @covers ::formatDate + * @expectedException Thelia\Core\Template\Smarty\Exception\SmartyPluginException */ public function testFormatDateWithoutDate() { diff --git a/templates/admin/default/ajax/thelia_news_feed.html b/templates/admin/default/ajax/thelia_news_feed.html index 360ca696b..fcc064ea9 100755 --- a/templates/admin/default/ajax/thelia_news_feed.html +++ b/templates/admin/default/ajax/thelia_news_feed.html @@ -7,7 +7,7 @@

- {$TITLE|strip_tags nofilter} - {format_date timestamp=$DATE} + {$TITLE|strip_tags nofilter} - {format_date timestamp=$DATE output='date'}