$GLOBALS['failed'] = "no";
set_error_handler(function($errno, $errstr) {
$GLOBALS['failed'] = "yes";
});
a_function_that_triggers_the_above_function();
echo $GLOBALS['failed']."\n"; # => "no"
That anonymous function is triggered, I’m 100% sure. Why isn’t the GLOBALS value changed?
Not sure what you are doing in your specific function that triggers an error, but using this portion of code :
I get the following output :
Which shows that :
(I’m using PHP 5.3.2)