PHP at (@) sign small note
@shakedko
IF AN EXPERT SAYS IT CAN'T BE DONE GET ANOTHER EXPERT.
- DAVID BEN-GURION

PHP at (@) sign small note

If you are executing a function using the @ sign, for example: @fopen($file); but the file does not exist, PHP will ignore the error and the function will return null.

However, when using set_error_handler you should know that the handler will be activated regardless the @ sign. This might be an issue, especially when using libraries from 3rd parties.

From php.net:

If you have set a custom error handler function with set_error_handler() then it will still get called, but this custom error handler can (and should) call error_reporting() which will return 0 when the call that triggered the error was preceded by an @.

Best practice would be:

function errorHandlerCatchUndefinedIndex($errno, $errstr, $errfile, $errline) {
    //make sure to check that @ sign is not throwing exceptions
    if (error_reporting() === 0) {
        return;
    }

    $message = "$errno, $errstr, $errfile, $errline";
    throw new \ErrorException($message, 0, $errno, $errfile, $errline);
}

set_error_handler('errorHandlerCatchUndefinedIndex');
PHP at (@) sign small note
PHP Manual Backtrace