From 43c780cb793ba748c1f7e6727d1156d6a2d300c7 Mon Sep 17 00:00:00 2001 From: Torben Wilson Date: Sun, 20 Aug 2000 10:49:33 +0000 Subject: [PATCH] Some clarifications & fixes. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@30586 c90b9560-bf6c-de11-be94-00142212c4b1 --- features/error-handling.xml | 273 +++++++++++++++++++----------------- 1 file changed, 147 insertions(+), 126 deletions(-) diff --git a/features/error-handling.xml b/features/error-handling.xml index 7730b9da1f..8ef68b30f5 100644 --- a/features/error-handling.xml +++ b/features/error-handling.xml @@ -2,141 +2,162 @@ Error handling - There are several types of errors and warnings in PHP. They are: + There are several types of errors and warnings in PHP. They are: - - PHP error types - - - - value - symbolic - description - note - - - - - 1 - E_ERROR - fatal run-time errors - - - - 2 - E_WARNING - run-time warnings (non fatal errors) - - - - 4 - E_PARSE - compile-time parse errors - - - - 8 - E_NOTICE - - run-time notices (less serious than warnings) - - - - - 16 - E_CORE_ERROR - fatal errors that occur during PHP's initial startup - PHP 4 only - - - 32 - E_CORE_WARNING - warnings (non fatal errors) that occur during PHP's initial startup - PHP 4 only - - - 64 - E_COMPILE_ERROR - fatal compile-time errors - PHP 4 only - - - 128 - E_COMPILE_WARNING - compile-time warnings (non fatal errors) - PHP 4 only - - - 256 - E_USER_ERROR - user-generated error message - PHP 4 only - - - 512 - E_USER_WARNING - user-generated warning message - PHP 4 only - - - 1024 - E_USER_NOTICE - user-generated notice message - PHP 4 only - - - - E_ALL - all of the above - PHP 4 only - - - -
-
+ + PHP error types + + + + Value + Constant + Description + Note + + + + + 1 + E_ERROR + fatal run-time errors + + + + 2 + E_WARNING + run-time warnings (non fatal errors) + + + + 4 + E_PARSE + compile-time parse errors + + + + 8 + E_NOTICE + + run-time notices (less serious than warnings) + + + + + 16 + E_CORE_ERROR + fatal errors that occur during PHP's initial startup + PHP 4 only + + + 32 + E_CORE_WARNING + warnings (non fatal errors) that occur during PHP's initial startup + PHP 4 only + + + 64 + E_COMPILE_ERROR + fatal compile-time errors + PHP 4 only + + + 128 + E_COMPILE_WARNING + compile-time warnings (non fatal errors) + PHP 4 only + + + 256 + E_USER_ERROR + user-generated error message + PHP 4 only + + + 512 + E_USER_WARNING + user-generated warning message + PHP 4 only + + + 1024 + E_USER_NOTICE + user-generated notice message + PHP 4 only + + + + E_ALL + all of the above, as supported + + + + +
+ - - The above values (either numerical or sombolic) are used to build up a - bitmask that specifies which errors to report. You can use the bitwise - operators '|','&' and '~' to combine theese values or mask out certain - types of errors. The default settings that will report anything but notice - messages are E_ALL & ~E_NOTICE for PHP4 and 7 for PHP 3 - (PHP 3 does not support the symbolic constants). - + + The above values (either numerical or symbolic) are used to build + up a bitmask that specifies which errors to report. You can use the + bitwise operators + to combine these values or mask out certain types of errors. Note + that only '|', '~', '!', and '&' will be understood within + php.ini, however, and that no bitwise + operators will be understood within php3.ini. + + + In PHP 4, the default error_reporting setting is + E_ALL & ~E_NOTICE, meaning to display all errors + and warnings which are not E_NOTICE-level. In PHP 3, the default + setting is (E_ERROR | E_WARNING | E_PARSE), + meaning the same thing. Note, however, that since constants are not + supported in PHP 3's php3.ini, the error_reporting setting there + must be numeric; hence, it is 7. + - - The settings can be changed in the ini file with the error_reporting - directive. It can also be set in your Apache httpd.conf file with - the php_error_reporting (php3_error_reporting for PHP 3) - directive or lastly it may be set at runtime within a script using - the error_reporting function. - - - - - When upgrading code or servers from PHP 3 to PHP 4 you should check - theese settings and calls to error_reporting or - you might disable reporting the new error types, especially E_COMPILE_ERROR. - This may lead to empty documents without any feedback of what happened + + The initial setting can be changed in the ini file with the error_reporting directive, in + your Apache httpd.conf file with the + php_error_reporting (php3_error_reporting for PHP 3) directive, and + lastly it may be set at runtime within a script by using the + error_reporting function. + + + + + When upgrading code or servers from PHP 3 to PHP 4 you should + check these settings and calls to + error_reporting or you might disable + reporting the new error types, especially E_COMPILE_ERROR. This + may lead to empty documents without any feedback of what happened or where to look for the problem. - + - - All PHP expressions can also be called - with the "@" prefix, which turns off error reporting for that particular - expression. If an error occurred during such an expression and the - track_errors feature - is enabled, you can find the error message in the global variable + + All PHP expressions can + also be called with the "@" prefix, which turns off error reporting + for that particular expression. If an error occurred during such + an expression and the track_errors feature is enabled, + you can find the error message in the global variable $php_errormsg. - - - Currently the "@" prefix will even disable error reporting for critical - errors that will terminate script execution. - - + + + Currently the @ + error-control operator prefix will even disable error + reporting for critical errors that will terminate script + execution. Among other things, this means that if you use @ to suppress + errors from a certain function and either it isn't available or + has been mistyped, the script will die right there with no + indication as to why. + +