From b483c5a19c5d36987a6fd35e9cccfddac3b167d5 Mon Sep 17 00:00:00 2001 From: mohrt Date: Thu, 25 Oct 2001 19:57:52 +0000 Subject: [PATCH] updated fetch to give proper warning when fetching unreadable or nonexistant files --- NEWS | 2 ++ Smarty.addons.php | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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); }