diff --git a/reference/errorfunc/functions/debug-backtrace.xml b/reference/errorfunc/functions/debug-backtrace.xml index 21945280cc..01c6a116f8 100755 --- a/reference/errorfunc/functions/debug-backtrace.xml +++ b/reference/errorfunc/functions/debug-backtrace.xml @@ -1,20 +1,27 @@ - + debug_backtrace Generates a backtrace - + + &reftitle.description; arraydebug_backtrace - debug_backtrace generates a PHP backtrace - and returns this information as an associative array. The - possible returned elements are listed in the following table: + debug_backtrace generates a PHP backtrace. + + + + + &reftitle.returnvalues; + + Returns an associative array. The possible returned elements + are as follows: @@ -80,14 +87,13 @@
- - The following is a simple example. - +
+ + + &reftitle.examples; - - <function>debug_backtrace</function> example - + <function>debug_backtrace</function> example - Results when executing /tmp/b.php: + Results similar to the following when executing + /tmp/b.php: + + + + &reftitle.seealso; - See also trigger_error and - debug_print_backtrace. + + trigger_error + debug_print_backtrace +
diff --git a/reference/errorfunc/functions/error-log.xml b/reference/errorfunc/functions/error-log.xml index 747a948108..3c9d5360d4 100644 --- a/reference/errorfunc/functions/error-log.xml +++ b/reference/errorfunc/functions/error-log.xml @@ -1,12 +1,13 @@ - + error_log Send an error message somewhere - + + &reftitle.description; interror_log @@ -17,69 +18,104 @@ Sends an error message to the web server's error log, a - TCP port or to a file. The first parameter, - message, is the error message that should be - logged. The second parameter, message_type says - where the message should go: - - <function>error_log</function> log types - - - - 0 - - message is sent to PHP's system logger, using - the Operating System's system logging mechanism or a file, depending - on what the error_log - configuration directive is set to. This is the default option. - - - - 1 - - message is sent by email to the address in - the destination parameter. This is the only - message type where the fourth parameter, - extra_headers is used. This message type - uses the same internal function as mail does. - - - - 2 - - message is sent through the PHP debugging - connection. This option is only available if remote debugging has - been enabled. In this case, the - destination parameter specifies the host name - or IP address and optionally, port number, of the socket receiving - the debug information. - - - - 3 - - message is appended to the file - destination. - - - - -
+ TCP port or to a file.
- - - When explicitly specifying the message_type as - 3, a newline is not automatically added to the end of - the message string. - - - - - Remote debugging via TCP/IP is a PHP 3 feature that is - not available in PHP 4. - - +
+ + + &reftitle.parameters; + + + + message + + + The error message that should be logged. + + + + + message_type + + + Says where the error should go. The possible message types are as + follows: + + + + <function>error_log</function> log types + + + + 0 + + message is sent to PHP's system logger, using + the Operating System's system logging mechanism or a file, depending + on what the error_log + configuration directive is set to. This is the default option. + + + + 1 + + message is sent by email to the address in + the destination parameter. This is the only + message type where the fourth parameter, + extra_headers is used. + + + + 2 + + message is sent through the PHP debugging + connection. This option is only available if remote debugging has + been enabled. In this case, the + destination parameter specifies the host name + or IP address and optionally, port number, of the socket receiving + the debug information. This option is only available in PHP 3. + + + + 3 + + message is appended to the file + destination. A newline is not automatically + added to the end of the message string. + + + + +
+
+
+
+ + destination + + + The destination. Its meaning depends on the + message parameter as described above. + + + + + extra_headers + + + The extra headers. It's used when the message + parameter is set to 1. + This message type uses the same internal function as + mail does. + + + +
+
+
+ + + &reftitle.examples; <function>error_log</function> examples diff --git a/reference/errorfunc/functions/error-reporting.xml b/reference/errorfunc/functions/error-reporting.xml index f1295911d4..4866c0afa4 100644 --- a/reference/errorfunc/functions/error-reporting.xml +++ b/reference/errorfunc/functions/error-reporting.xml @@ -1,12 +1,13 @@ - + error_reporting Sets which PHP errors are reported - + + &reftitle.description; interror_reporting @@ -19,16 +20,136 @@ this function sets that level for the duration (runtime) of your script. + + + + &reftitle.parameters; - error_reporting sets PHP's error reporting level, - and returns the old level. The level parameter - takes on either a bitmask, or named constants. Using named constants - is strongly encouraged to ensure compatibility for future versions. As - error levels are added, the range of integers increases, so older - integer-based error levels will not always behave as expected. + + + level + + + The new error_reporting + level. It takes on either a bitmask, or named constants. Using named + constants is strongly encouraged to ensure compatibility for future + versions. As error levels are added, the range of integers increases, + so older integer-based error levels will not always behave as expected. + + + The available error level constants are listed below. The actual + meanings of these error levels are described in the + predefined constants. + + <function>error_reporting</function> level constants and bit values + + + + value + constant + + + + + 1 + + E_ERROR + + + + 2 + + E_WARNING + + + + 4 + + E_PARSE + + + + 8 + + E_NOTICE + + + + 16 + + E_CORE_ERROR + + + + 32 + + E_CORE_WARNING + + + + 64 + + E_COMPILE_ERROR + + + + 128 + + E_COMPILE_WARNING + + + + 256 + + E_USER_ERROR + + + + 512 + + E_USER_WARNING + + + + 1024 + + E_USER_NOTICE + + + + 2047 + + E_ALL + + + + 2048 + + E_STRICT + + + + +
+
+
+
+
+
+ + + &reftitle.returnvalues; - + Returns the old error_reporting + level. + + + + + &reftitle.examples; + + <function>error_reporting</function> examples - - The available error level constants are listed below. The actual - meanings of these error levels are described in the - predefined constants. - - <function>error_reporting</function> level constants and bit values - - - - value - constant - - - - - 1 - - E_ERROR - - - - 2 - - E_WARNING - - - - 4 - - E_PARSE - - - - 8 - - E_NOTICE - - - - 16 - - E_CORE_ERROR - - - - 32 - - E_CORE_WARNING - - - - 64 - - E_COMPILE_ERROR - - - - 128 - - E_COMPILE_WARNING - - - - 256 - - E_USER_ERROR - - - - 512 - - E_USER_WARNING - - - - 1024 - - E_USER_NOTICE - - - - 2047 - - E_ALL - - - - 2048 - - E_STRICT - - - - -
-
+
+ + + &reftitle.notes; With PHP > 5.0.0 E_STRICT with value 2048 is @@ -166,9 +195,15 @@ ini_set('error_reporting', E_ALL); to include E_STRICT errors. + + + + &reftitle.seealso; - See also the display_errors - directive and ini_set. + + The display_errors directive + ini_set +
diff --git a/reference/errorfunc/functions/restore-error-handler.xml b/reference/errorfunc/functions/restore-error-handler.xml index d01573fdd5..1c4d2d6315 100644 --- a/reference/errorfunc/functions/restore-error-handler.xml +++ b/reference/errorfunc/functions/restore-error-handler.xml @@ -1,14 +1,13 @@ - + restore_error_handler - - Restores the previous error handler function - + Restores the previous error handler function - + + &reftitle.description; boolrestore_error_handler @@ -17,27 +16,26 @@ Used after changing the error handler function using set_error_handler, to revert to the previous error - handler (which could be the built-in or a user defined function). This - function always returns &true;. + handler (which could be the built-in or a user defined function). - - - Calling restore_error_handler from the - error_handler function is ignored. - - + + + + &reftitle.returnvalues; - See also error_reporting, - set_error_handler, - restore_exception_handler, - trigger_error. + This function always returns &true; + + + + &reftitle.examples; - + <title><function>restore_error_handler</function> example + Decide if unserialize caused an error, then restore the original error handler. - + + + + &reftitle.notes; + + + Calling restore_error_handler from the + error_handler function is ignored. + + + + + + &reftitle.seealso; + + + error_reporting + set_error_handler + restore_exception_handler + trigger_error + + + + restore_exception_handler @@ -7,7 +7,8 @@ Restores the previously defined exception handler function - + + &reftitle.description; boolrestore_exception_handler @@ -17,14 +18,26 @@ Used after changing the exception handler function using set_exception_handler, to revert to the previous exception handler (which could be the built-in or a user defined - function). This function always returns &true;. + function). + + + + &reftitle.returnvalues; - See also - set_exception_handler, - set_error_handler, - restore_error_handler - error_reporting + This function always returns &true; + + + + + &reftitle.seealso; + + + set_exception_handler + set_error_handler + restore_error_handler + error_reporting + diff --git a/reference/errorfunc/functions/set-error-handler.xml b/reference/errorfunc/functions/set-error-handler.xml index 0903038dcf..ad5cc61f1f 100644 --- a/reference/errorfunc/functions/set-error-handler.xml +++ b/reference/errorfunc/functions/set-error-handler.xml @@ -1,5 +1,5 @@ - + @@ -8,7 +8,8 @@ Sets a user-defined error handler function - + + &reftitle.description; mixedset_error_handler @@ -17,10 +18,7 @@ Sets a user function (error_handler) to handle - errors in a script. Returns a string containing the previously defined - error handler (if any), or &false; on error. If the previous handler - was a class method, this function will return an indexed array with - the class and the method name. + errors in a script. This function can be used for defining your own way of handling errors @@ -30,106 +28,190 @@ trigger_error). - The second parameter error_types was introduced in - PHP 5 and can be used to mask the triggering of the - error_handler function just like the error_reporting ini setting controls - which errors are shown. Without this mask set the - error_handler will be called for every error - regardless to the setting of the error_reporting setting. + It is important to remember that the standard PHP error handler is completely + bypassed. error_reporting settings will have no effect + and your error handler will be called regardless - however you are still + able to read the current value of error_reporting and + act appropriately. Of particular note is that this value will be 0 if the + statement that caused the error was prepended by the + @ error-control + operator. - The user function needs to accept two parameters: the error code, and a - string describing the error. From PHP 4.0.2, three optional - parameters are supplied: the filename in which the error occurred, the - line number in which the error occurred, and the context in which the - error occurred (an array that points to the active symbol table at the - point the error occurred). The function can be shown as: - - handler - interrno - stringerrstr - stringerrfile - interrline - arrayerrcontext - + Also note that it is your responsibility to die if + necessary. If the error-handler function returns, script execution + will continue with the next statement after the one that caused an error. + + + The following error types cannot be handled with a user defined + function: E_ERROR, E_PARSE, + E_CORE_ERROR, E_CORE_WARNING, + E_COMPILE_ERROR, + E_COMPILE_WARNING, and + most of E_STRICT raised in the file where + set_error_handler is called. + + + If errors occur before the script is executed (e.g. on file uploads) the + custom error handler cannot be called since it is not registered at that + time. + + + + + &reftitle.parameters; + - errno + error_handler - - The first parameter, errno, contains the - level of the error raised, as an integer. - + + The user function needs to accept two parameters: the error code, and a + string describing the error. Then there are three optional parameters + that may be supplied: the filename in which the error occurred, the + line number in which the error occurred, and the context in which the + error occurred (an array that points to the active symbol table at the + point the error occurred). The function can be shown as: + + + + handler + interrno + stringerrstr + stringerrfile + interrline + arrayerrcontext + + + + errno + + + The first parameter, errno, contains the + level of the error raised, as an integer. + + + + + errstr + + + The second parameter, errstr, contains the + error message, as a string. + + + + + errfile + + + The third parameter is optional, errfile, + which contains the filename that the error was raised in, as a string. + + + + + errline + + + The fourth parameter is optional, errline, + which contains the line number the error was raised at, as an integer. + + + + + errcontext + + + The fifth parameter is optional, errcontext, + which is an array that points to the active symbol table at the point + the error occurred. In other words, errcontext + will contain an array of every variable that existed in the scope the + error was triggered in. + + + + + - errstr + error_types - - The second parameter, errstr, contains the - error message, as a string. - - - - - errfile - - - The third parameter is optional, errfile, - which contains the filename that the error was raised in, as a string. - - - - - errline - - - The fourth parameter is optional, errline, - which contains the line number the error was raised at, as an integer. - - - - - errcontext - - - The fifth parameter is optional, errcontext, - which is an array that points to the active symbol table at the point - the error occurred. In other words, errcontext - will contain an array of every variable that existed in the scope the - error was triggered in. - + + Can be used to mask the triggering of the + error_handler function just like the error_reporting ini setting + controls which errors are shown. Without this mask set the + error_handler will be called for every error + regardless to the setting of the error_reporting setting. + - - - Instead of a function name, an array containing an object reference and - a method name can also be supplied. (Since PHP 4.3.0) - - - - - The following error types cannot be handled with a user defined - function: E_ERROR, E_PARSE, - E_CORE_ERROR, E_CORE_WARNING, - E_COMPILE_ERROR, - E_COMPILE_WARNING, and - most of E_STRICT raised in the file where - set_error_handler is called. - - + + + + &reftitle.returnvalues; + + Returns a string containing the previously defined + error handler (if any), or &false; on error. If the previous handler + was a class method, this function will return an indexed array with + the class and the method name. + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 5.0.0 + + The error_types parameter was introduced. + + + + 4.3.0 + + Instead of a function name, an array containing an object reference + and a method name can also be supplied as the + error_handler. + + + + 4.0.2 + + Three optional parameters for the error_handler + user function was introduced. These are the filename, the line number, + and the context. + + + + + + + + + + &reftitle.examples; - The example below shows the handling of internal exceptions by - triggering errors and handling them with a user defined function: - - Error handling with <function>set_error_handler</function> and - <function>trigger_error</function> - + Error handling with <function>set_error_handler</function> and <function>trigger_error</function> + + The example below shows the handling of internal exceptions by + triggering errors and handling them with a user defined function: + ]]> - &example.outputs; + &example.outputs.similar; + + + + &reftitle.seealso; - It is important to remember that the standard PHP error handler is completely - bypassed. error_reporting settings will have no effect - and your error handler will be called regardless - however you are still - able to read the current value of error_reporting and - act appropriately. Of particular note is that this value will be 0 if the - statement that caused the error was prepended by the - @ error-control - operator. - - - Also note that it is your responsibility to die if - necessary. If the error-handler function returns, script execution - will continue with the next statement after the one that caused an error. - - - - If errors occur before the script is executed (e.g. on file uploads) the custom - error handler cannot be called since it is not registered at that time. - - - - - The second parameter error_types was introduced - in PHP 5. - - - - See also error_reporting, - restore_error_handler, - trigger_error, - error level constants, - &listendand; &seealso.callback;. + + error_reporting + restore_error_handler + trigger_error + error level constants + &seealso.callback; + diff --git a/reference/errorfunc/functions/trigger-error.xml b/reference/errorfunc/functions/trigger-error.xml index 3cbde44068..23abf6dfd0 100644 --- a/reference/errorfunc/functions/trigger-error.xml +++ b/reference/errorfunc/functions/trigger-error.xml @@ -1,14 +1,13 @@ - + trigger_error - - Generates a user-level error/warning/notice message - + Generates a user-level error/warning/notice message - + + &reftitle.description; booltrigger_error @@ -19,18 +18,57 @@ Used to trigger a user error condition, it can be used by in conjunction with the built-in error handler, or with a user defined function that has been set as the new error handler - (set_error_handler). It only works with the E_USER - family of constants, and will default to E_USER_NOTICE. + (set_error_handler). + + This function is useful when you need to generate a particular response to + an exception at runtime. + + + + + &reftitle.parameters; + + + + error_msg + + + The designated error message for this error. It's limited to 1024 + characters in length. Any additional characters beyond 1024 will be + truncated. + + + + + error_type + + + The designated error type for this error. It only works with the E_USER + family of constants, and will default to E_USER_NOTICE. + + + + + + + + + &reftitle.returnvalues; This function returns &false; if wrong error_type is specified, &true; otherwise. + + + + &reftitle.examples; - This function is useful when - you need to generate a particular response to an exception at runtime. - For example: - + + <function>trigger_error</function> example + + See set_error_handler for a more extensive example. + ]]> - - - - See set_error_handler for a more extensive example. - - - - - error_msg is limited to 1024 characters in length. - Any additional characters beyond 1024 will be truncated. - - + + + + + &reftitle.seealso; - See also error_reporting, - set_error_handler, - restore_error_handler, and - error level constants. + + error_reporting + set_error_handler + restore_error_handler + The error level constants + diff --git a/reference/errorfunc/functions/user-error.xml b/reference/errorfunc/functions/user-error.xml index d872fb1fca..3f0f4ee4f7 100644 --- a/reference/errorfunc/functions/user-error.xml +++ b/reference/errorfunc/functions/user-error.xml @@ -1,15 +1,17 @@ - + user_error Alias of trigger_error - + + &reftitle.description; - This function is an alias of trigger_error. + &info.function.alias; + trigger_error.