note 45466 added to function.error-reporting
| From: | ferozzahid | Date: | Wed, 08 Sep 2004 11:31:00 +0000 |
| Subject: | note 45466 added to function.error-reporting | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76220@lists.php.net to get a copy of this message | ||
To be enable to switch between error_reporting during development and release phases, one can define
say 'php_error_reporting' in the main configuration file (ini like file: no PHP) for the
application as:
# config.ini
# PHP error reporting. supported values are given below.
# 0 - Turn off all error reporting
# 1 - Running errors
# 2 - Running errors + notices
# 3 - All errors except notices and warnings
# 4 - All errors except notices
# 5 - All errors
php_error_reporting=4
# config.ini ends
Setting error_reporting in PHP files would be something like the code below, assuming the function
getinivar() returns the variable value from the configuration file.
[code]
// setting PHP error reporting
switch(getinivar('php_error_reporting')) {
case 0: error_reporting(0); break;
case 1: error_reporting(E_ERROR | E_WARNING | E_PARSE); break;
case 2: error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); break;
case 3: error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); break;
case 4: error_reporting(E_ALL ^ E_NOTICE); break;
case 5: error_reporting(E_ALL); break;
default:
error_reporting(E_ALL);
}
[/code]
Feroz Zahid.
----
Manual Page -- http://www.php.net/manual/en/function.error-reporting.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45466
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45466&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45466&report=yes
Search -- http://master.php.net/manage/user-notes.php