note 48956 added to function.error-reporting
| From: | php-general at lists dot php dot net | Date: | Thu, 13 Jan 2005 00:55:26 +0000 |
| Subject: | note 48956 added to function.error-reporting | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83175@lists.php.net to get a copy of this message | ||
The following note might save somebody for several hours of debugging:
error_reporting() might be tricky when used for scopes. E.g. if you include some third party module,
you might wan't to stop error reporting for this module but keep a restrictive policy for your
own code. Beware that the following (which seems like a natural solution) will NOT work:
<?
error_reporting(0); // Turning error_reporting off
require_once("thirdparty_module.php");
error_reporting(E_ALL); // Turning it on again
...
...
?>
You can suppress error reporting if the inclusion is done in the bottom of the file:
<?
...
...
error_reporting(0); // Turning error_reporting off
require_once("thirdparty_module.php");
?>
but if your script is beeing included into another file, this might not be a proper solution.
I have not yet found a way to restrict error reporting for only parts of the code.
----
Manual Page -- http://www.php.net/manual/en/function.error-reporting.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48956
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48956&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48956&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48956&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48956&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48956&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48956&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48956&report=yes
Search -- http://master.php.net/manage/user-notes.php