note 107447 added to function.error-reporting
| From: | teynon1 at gmail dot com | Date: | Thu, 09 Feb 2012 20:51:01 +0000 |
| Subject: | note 107447 added to function.error-reporting | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185955@lists.php.net to get a copy of this message | ||
It might be a good idea to include E_COMPILE_ERROR in error_reporting.
If you have a customer error handler that does not output warnings, you may get a white screen of
death if a "require" fails.
Example:
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
function myErrorHandler($errno, $errstr, $errfile, $errline) {
// Do something other than output message.
return true;
}
$old_error_handler = set_error_handler("myErrorHandler");
require "this file does not exist";
?>
To prevent this, simply include E_COMPILE_ERROR in the error_reporting.
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 74.219.116.251
----
Manual Page -- http://www.php.net/manual/en/function.error-reporting.php
Edit -- https://master.php.net/note/edit/107447
Del: integrated -- https://master.php.net/note/delete/107447/integrated
Del: useless -- https://master.php.net/note/delete/107447/useless
Del: bad code -- https://master.php.net/note/delete/107447/bad+code
Del: spam -- https://master.php.net/note/delete/107447/spam
Del: non-english -- https://master.php.net/note/delete/107447/non-english
Del: in docs -- https://master.php.net/note/delete/107447/in+docs
Del: other reasons-- https://master.php.net/note/delete/107447
Reject -- https://master.php.net/note/reject/107447
Search -- https://master.php.net/manage/user-notes.php