[nycphp-talk] @include() affects all error_reporting !?!?
Daniel Kushner
nyphp at websapp.com
Fri Jul 25 23:07:34 EDT 2003
I agree with Adam that errors are your friend and you should see all PHP
generated errors. This, as Jonathan pointed out, is not suffice and you need
to program some error handling on your own because your production server
should NEVER display PHP generated errors.
Best,
Daniel Kushner
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Jonathan Rury
> Sent: Friday, July 25, 2003 10:50 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] @include() affects all error_reporting !?!?
>
>
> Errors are your friend but there are often better ways to handle
> errors than
> just allowing PHP to dump its error message to the end-user,
> which often is
> confusing to the person unfamiliar with PHP.
>
> For instance, opening a database connection like this:
> @ $db = mysql_connect($HOST, $MYSQL_USER_NAME, $MYSQL_USER_PASSWORD);
> if (!$db) // error connecting to database
> { // inform user and provide solutions
> echo "Error: Could not connect to database. Please try
> again later.
> or contact help at blah.com;";
> exit;
> }
> is much better than just saying
> $db = mysql_connect($HOST, $MYSQL_USER_NAME, $MYSQL_USER_PASSWORD);
> which will continue executing the script, and waste cycles, while
> dumping a
> much less meaningful error message.
>
> Good coding practice is not to ignore malformed input or errors BUT better
> coding is to respond intelligently to errors, rather than just
> dumping error
> messages.
>
>
> > 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
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
More information about the talk
mailing list