Re: Re: cvs: pear /Image_Barcode ChangeLog Readme.txt barcode_img.php package.xml test-image-barcode.php /Image_Barcode/Barcode Code39.php ean13.php
int25.php upca.php
| From: | Justin Patrin | Date: | Thu, 26 May 2005 03:23:50 +0000 |
| Subject: | Re: Re: cvs: pear /Image_Barcode ChangeLog Readme.txt barcode_img.php package.xml test-image-barcode.php /Image_Barcode/Barcode Code39.php ean13.php int25.php upca.php |
||
| References: | 1 2 3 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-2740@lists.php.net to get a copy of this message | ||
On 5/25/05, Stephan Schmidt <schst@php-tools.net> wrote:
> Hi,
>
> Daniel Convissor schrieb:
> > @include_once("Image/Barcode/${type}.php");
> >
> > Second, the @ suppresses all errors inside the included file, not just the
> > include call itself. Before doing the include, do a file_exists check and
> > return a PEAR error if the file doesn't exist.
> Please don't use file_exists(), as it does not check in your include
> path. Using @include_once is IMHO the only way to achieve what he's
> trying to do.
>
Except that this stops all errors, including file not found (which you
can "fix" by raising an error if the call fails), but parse errors in
the included file cause the script to die without any error or
response.
file_exists can still be used, but the code has to loop through the
include_path to check for the file.
OR
You can use something like this, as long as you don't worry about
allowing users to put their drivers in their own directories.
include_once(dirname(__FILE__).'/drivers/'.$driver.'.php');
OR
you can say to hell with "file not found" errors and use include_once
without the @. IMHO attempting to include a driver which does not
exist is a pretty fatal error anyway. If someone doesn't want these
errors showing up they can easily set display_errors or
error_reporting to 0.
--
Justin Patrin