For Programmers: Free Programming Magazines  


Home > Archive > PHP PEAR Questions and Answers > May 2005 > Re: [PEAR-QA] Re: [PEAR-CVS] cvs: pear /Image_Barcode ChangeLog Readme.txt barcode_im









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR-QA] Re: [PEAR-CVS] cvs: pear /Image_Barcode ChangeLog Readme.txt barcode_im
Justin Patrin

2005-05-26, 8:57 pm

On 5/25/05, Stephan Schmidt <schst@php-tools.net> wrote:
> Hi,
>=20
> Daniel Convissor schrieb:
the[color=darkred]
and[color=darkred]
> 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.
>=20


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.

--=20
Justin Patrin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com