You can create your own error handler to catch E_NOTICEs.
This has not been verified, but should go in the right direction:
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
if ($errno == E_USER_NOTICE)
die ("Fatal notice");
else
return false;
}
then install it as a new custom error handler using set_error_handler()when entering your function and restore the PHP error handler when it exits:
function some_function()
{
$old_error_handler = set_error_handler("myErrorHandler");
... do your stuff ....
set_error_handler($old_error_handler);
}
source
share