Reputation: 746
TCPDF uses a lot the PHP @ operator to suppress error. As my application use a custom error handler, it still get these "suppressed" errors.
How can I make it ignore @-suppressed errors?
I thought of finding out if the error comes from TCPDF using the backtrace but the error may come from a line not using @ operator. Such a line looks like (l. 6882) for instance:
if (($imsize = @getimagesize($file)) === FALSE) {
I've asked Nicola Asuni (TCPDF creator) about this specific error and he said: "The code is working fine and the error has been suppressed on purpose".
I use PHP function set_error_handler to handle errors.
And the following: error_reporting(E_ALL); on PHP 5.4
Upvotes: 1
Views: 664
Reputation: 18923
Check for error_reporting()
inside the error handler (you should read the PHP Documentation, it explains your concrete case there)
See the example (adapted from PHP DOCS):
function myErrorHandler($errno, $errstr, $errfile, $errline ) {
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting or was called with @
return;
}
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler('myErrorHandler');
@strpos();
Upvotes: 2