Re: [SMARTY-DEV] improper check for existance of a file when including PHP files
| From: | Monte Ohrt | Date: | Wed, 11 Dec 2002 17:35:11 +0000 |
| Subject: | Re: [SMARTY-DEV] improper check for existance of a file when including PHP files | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-403@lists.php.net to get a copy of this message | ||
This method takes two file stats to perform the same operation instead
of one. That is why one was used with an "@" to suppress it.
I believe there is a way to tell if an error was suppressed with an "@"
or not, you should consider that in your error handler.
Monte
On Wed, 2002-12-11 at 04:19, Yuri Weseman wrote:
> Hi everyone,
>
> Recently we installed a custom error handler for PHP, that shows a nifty
> error screen when critical errors occur in PHP scripts. Also, the script
> sends mails when not so critical errors have occurred. Now I've noticed that
> Smarty generates an error in line 866 of Smarty.class.php (version 2.3.0).
> In get_php_resource a check is done to see if the resource exists by using
> is_file. To suppress any errors an @ sign is placed in front of it. But
> still this does trigger our error handler and thus generates mails.
>
> A more clean approach would be to use file_exists first.
>
> Line 866 is now:
> if (is_file($resource_name)) {
>
> I suggest it will be:
> if (file_exists($resource_name) && is_file($resource_name)) {
>
> Included is a diff file so that Smarty can be patched.
>
> Greetings,
>
> Yuri Weseman
>
> ______________________________________________________________________
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Monte Ohrt <monte@ispi.net>