Re: PEAR Coding Standards
| From: | Florent Monnier | Date: | Mon, 03 May 2004 21:31:45 +0000 |
| Subject: | Re: PEAR Coding Standards | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-28736@lists.php.net to get a copy of this message | ||
Thorsten Suckow-Homberg a écrit :
> > This is not a good idea. Hust imagine you are opening a socket, ftp
> > connections or anything else that works with a remote server... If the
> > connection times out, there will be a warning...
>
> You are right with this. But sometimes it would help more to get a
> PEAR_Error instead of ugly notices, warnings etc., for example when you
> want to access a specific function where the possibility is high that it is
> not installed on every server...
> Use function_exists("yadayada") instead of @yadayada, that was my main
> intention.
Indeed, on this point there is an error in your Image_Imagick proposal version
alpha 0.2 (not just one but this thread is about '@').
In the function addUserFilter(), your include won't work in case that
somefile.php does not exists if you strip the '@':
I think you should put it back this way, for this code to work as you expect:
$bCheckReq = @include_once 'somefile.php';
if (!$bCheckReq) {
//error handling
}
If you really want to remove all '@' from your code, perhaps another solution
would be to use if(file_exists() && is_readable()) {/*safe include*/}