[nycphp-talk] @include() affects all error_reporting !?!?
Adam Fields
fields at surgam.net
Fri Jul 25 22:46:05 EDT 2003
On Fri, Jul 25, 2003 at 08:11:17PM -0400, George Webb wrote:
[...]
> I have seen this behavior in PHP versions 4.0.8 through
> 4.3.2. Does anyone agree that this is a bug? In any case,
> how can we elegantly work-around it? I need to be able to control
> error reporting from the included file, which may or may not exist.
Bad Bad Bad!
Please don't use the @ operator. An error means that >SOMETHING IS
WRONG<, and you shouldn't just throw that information away. Test for
the existence of the file and only include it if it exists. In PHP5,
use exception handling.
I recently installed GForge, and they use @ all over the place,
particular in front of the database connection code. So if your
database isn't working, you just get a blank html page. No errors, no
error log, just... nothing. It's terribly irritating, and particularly
bad coding form.
Errors are your friend!
--
- Adam
-----
Adam Fields, Managing Partner, fields at surgam.net
Surgam, Inc. is a technology consulting firm with strong background in
delivering scalable and robust enterprise web and IT applications.
http://www.adamfields.com
More information about the talk
mailing list