You could just create a custom error handler, and have it suppress all errors, or at least all notices... -Sean
On Fri, Mar 27, 2009 at 10:45 AM, Michael Jones <[email protected]> wrote: > Daniel C. wrote: > >> On Fri, Mar 27, 2009 at 9:40 AM, Kevin<[email protected]> wrote: >> >> >>> "Error suppression is slow. This is because PHP dynamically changes >>> error_reporting to 0 before executing the suppressed statement, then >>> immediately changes it back. This is expensive." >>> >>> >> >> Cool, I didn't know that. >> >> >> >>> Using error suppression is always a bad thing. It makes debugging in the >>> future much more difficult. If you want to include only files that exist >>> just wrap it in an if ( file_exists($file) ). This makes the code much >>> more >>> clearer [sic] and you don't sacrifice missing other potential errors that >>> include_once might throw. >>> >>> >> >> Aside from the slowness, I don't see how the two are different. >> Either way you're ensuring that include_once doesn't screw up your >> program. >> >> >> > Essentially, you are acknowledging that there will likely be an error when > including the file. By wrapping the include in a file_exists($file) > function, you are actually handling the error, rather than just ignoring it. > Plus, this way you could have the code do something different if the file > doesn't exist, whereas if you just ignore the error there is no way for the > rest of the script to know whether or not the file was included. > > > -Dan >> >> _______________________________________________ >> >> UPHPU mailing list >> [email protected] >> http://uphpu.org/mailman/listinfo/uphpu >> IRC: #uphpu on irc.freenode.net >> >> > > > _______________________________________________ > > UPHPU mailing list > [email protected] > http://uphpu.org/mailman/listinfo/uphpu > IRC: #uphpu on irc.freenode.net > _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
