@shakedko
IF AN EXPERT SAYS IT CAN'T BE DONE GET ANOTHER EXPERT.
- DAVID BEN-GURION
05-04-2018

Manually backtrace code in PHP instead of searching the entire stack trace.

05-04-2018

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');
12-03-2018

PHP Google Spreadsheet Integration via CLI

07-03-2018

Canvas Auto Gradient Change On Image Background