NogDog;11033679 wrote:Yeah, you'd have to actually implement a custom error handler that turns it into an exception.
I wish PHP did a lot more with exceptions retroactively rather than only moving forward. Either way, I suppose one might load a file via auto_prepend_file that looks like:
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler("exception_error_handler");
to take care of that.
(Now that I think about that, it actually seems pretty nifty... not sure how backwards-compatible it is, though.)
NogDog;11033679 wrote:As far as I'm concerned, the "@" is not a big deal as long as you are explicitly checking the return value for an error and handling it yourself, as you are in this case.
Agreed. Suppressing errors for the sake of gracefully handling them is one thing. Suppressing errors for the sake of hiding errors (e.g. sweeping them under the rug), however, is not.