Is it possible to change the error reporting level (turn off E_STRICT) for files that my PHP application includes with include or require_once?
I’d like to be able to see strict notices that occur in my code, but I’m using PEAR MDB2, and I get pages of warnings from that code when I turn on E_STRICT.
I know that it’s possible to change error_reporting on a per-directory basis with an .htaccess file but I don’t think that works with included files. I tried putting it in the pear folder but it did nothing.
You could define a custom error handler, and use the
$errfileargument to determine where the error came from. If the path matches the path your included library, suppress the error. Otherwise, pass it on to PHP’s error reporting.As far as I can see, this should catch any and all warnings and notices caused by the library.
Because no backtrace is necessary, it’s probably even fast enough for a lot of triggered messages.
this is untested but should work, based on the example in the manual: