diff --git a/NEWS b/NEWS index ffdd1f50..8e002e2b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - update fetch function to give proper warning when fetching a non-readable + or non-existant file (Monte) - fixed problem with newline at the end of included templates (Monte, Andrei) - added feature to regenerate cache if compile_check is enabled and an involved template or config file gets modified (Monte) diff --git a/Smarty.addons.php b/Smarty.addons.php index dcc2f988..d80ce880 100644 --- a/Smarty.addons.php +++ b/Smarty.addons.php @@ -572,10 +572,14 @@ function smarty_func_fetch($args, &$smarty_obj) { } } if (!$resource_is_secure) { - $smarty_obj->_trigger_error_msg("(secure mode) fetching '$file' is not allowed"); + $smarty_obj->_trigger_error_msg("(secure mode) fetch '$file' is not allowed"); return; - } + } } + if (!@is_readable($file)) { + $smarty_obj->_trigger_error_msg("fetch cannot read file '$file'"); + return; + } readfile($file); }