From cb7c0c06545e7943b2de0c595c9e070b8027e0a6 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Wed, 13 Nov 2024 15:05:02 +0000 Subject: [PATCH] Use modern markup for E_* constants (#4056) - Indicate that E_STRICT is deprecated as of PHP 8.4.0 - explain the case where E_RECOVERABLE_ERROR can happen - E_USER_ERROR should not be used any more. - Rewording which removes personalization Co-authored-by: Christoph M. Becker --- reference/errorfunc/constants.xml | 548 +++++++++++++++++------------- 1 file changed, 314 insertions(+), 234 deletions(-) diff --git a/reference/errorfunc/constants.xml b/reference/errorfunc/constants.xml index 783a7045d2fb..3ccdf517943f 100644 --- a/reference/errorfunc/constants.xml +++ b/reference/errorfunc/constants.xml @@ -3,258 +3,338 @@ &reftitle.constants; &extension.constants.core; - - - You may use these constant names in &php.ini; but not outside - of PHP, like in &httpd.conf;, where you'd - use the bitmask values instead. - - - - Errors and Logging - - - - Value - Constant - Description - Note - - - - - 1 - - E_ERROR - (int) - - - Fatal run-time errors. These indicate errors that can not be - recovered from, such as a memory allocation problem. - Execution of the script is halted. - - - - - 2 - - E_WARNING - (int) - - - Run-time warnings (non-fatal errors). Execution of the script is not - halted. - - - + + The following constants (either the corresponding numerical value or their + symbolic name) are used as a bitmask to specify which errors to report. + It is possible to use + bitwise operators + to combine these values or mask out certain types of errors. + - - 4 - - E_PARSE - (int) - - - Compile-time parse errors. Parse errors should only be generated by - the parser. - - - + + + The name of the constants can be used within &php.ini;, + instead of the raw numerical values to which they correspond to. + However, only the + |, + ~, + ^, + !, + & + operators are understood within &php.ini;. + + - - 8 - - E_NOTICE - (int) - - - Run-time notices. Indicate that the script encountered something that - could indicate an error, but could also happen in the normal course of - running a script. - - - + + + It is not possible to use the symbolic names outside of PHP. + For example in &httpd.conf; the computed bitmask value must be used instead. + + - - 16 - - E_CORE_ERROR - (int) - - - Fatal errors that occur during PHP's initial startup. This is like an - E_ERROR, except it is generated by the core of PHP. - - - + + + + E_ERROR + (int) + + + + Fatal run-time errors. + These indicate errors that can not be recovered from, + such as a memory allocation problem. + Execution of the script is halted. + + + Value of the constant: 1 + + + - - 32 - - E_CORE_WARNING - (int) - - - Warnings (non-fatal errors) that occur during PHP's initial startup. - This is like an E_WARNING, except it is generated - by the core of PHP. - - - + + + E_WARNING + (int) + + + + Run-time warnings (non-fatal errors). + Execution of the script is not halted. + + + Value of the constant: 2 + + + - - 64 - - E_COMPILE_ERROR - (int) - - - Fatal compile-time errors. This is like an E_ERROR, - except it is generated by the Zend Scripting Engine. - - - + + + E_PARSE + (int) + + + + Compile-time parse errors. + Parse errors should only be generated by the parser. + + + Value of the constant: 4 + + + - - 128 - - E_COMPILE_WARNING - (int) - - - Compile-time warnings (non-fatal errors). This is like an - E_WARNING, except it is generated by the Zend - Scripting Engine. - - - + + + E_NOTICE + (int) + + + + Run-time notices. + Indicate that the script encountered something that could indicate an error, + but could also happen in the normal course of running a script. + + + Value of the constant: 8 + + + - - 256 - - E_USER_ERROR - (int) - - - User-generated error message. This is like an - E_ERROR, except it is generated in PHP code by - using the PHP function trigger_error. - - - + + + E_CORE_ERROR + (int) + + + + Fatal errors that occur during PHP's initial startup. + This is like an E_ERROR, + except it is generated by the core of PHP. + + + Value of the constant: 16 + + + - - 512 - - E_USER_WARNING - (int) - - - User-generated warning message. This is like an - E_WARNING, except it is generated in PHP code by - using the PHP function trigger_error. - - - + + + E_CORE_WARNING + (int) + + + + Warnings (non-fatal errors) that occur during PHP's initial startup. + This is like an E_WARNING, + except it is generated by the core of PHP. + + + Value of the constant: 32 + + + - - 1024 - - E_USER_NOTICE - (int) - - - User-generated notice message. This is like an - E_NOTICE, except it is generated in PHP code by - using the PHP function trigger_error. - - - + + + E_COMPILE_ERROR + (int) + + + + Fatal compile-time errors. + This is like an E_ERROR, + except it is generated by the Zend Scripting Engine. + + + Value of the constant: 64 + + + - - 2048 - - E_STRICT - (int) - - - Enable to have PHP suggest changes - to your code which will ensure the best interoperability - and forward compatibility of your code. - - - + + + E_COMPILE_WARNING + (int) + + + + Compile-time warnings (non-fatal errors). + This is like an E_WARNING, + except it is generated by the Zend Scripting Engine. + + + Value of the constant: 128 + + + - - 4096 - - E_RECOVERABLE_ERROR - (int) - - - Catchable fatal error. It indicates that a probably dangerous error - occurred, but did not leave the Engine in an unstable state. If the error - is not caught by a user defined handle (see also - set_error_handler), the application aborts as it - was an E_ERROR. - - - + + + E_DEPRECATED + (int) + + + + Run-time deprecation notices. + Enable this to receive warnings about code + that will not work in future versions. + + + Value of the constant: 8192 + + + - - 8192 - - E_DEPRECATED - (int) - - - Run-time notices. Enable this to receive warnings about code - that will not work in future versions. - - - + + + E_USER_ERROR + (int) + + + + User-generated error message. + This is like an E_ERROR, + except it is generated in PHP code by using the PHP function + trigger_error. + + + Value of the constant: 256 + + + + Usage of this constant with trigger_error is + deprecated as of PHP 8.4.0. + It is recommended to either &throw; an Exception + or call exit instead. + + + + - - 16384 - - E_USER_DEPRECATED - (int) - - - User-generated warning message. This is like an - E_DEPRECATED, except it is generated in PHP code by - using the PHP function trigger_error. - - - + + + E_USER_WARNING + (int) + + + + User-generated warning message. + This is like an E_WARNING, + except it is generated in PHP code by using the PHP function + trigger_error. + + + Value of the constant: 512 + + + - - 32767 - - E_ALL - (int) - - - All errors, warnings, and notices. - - - + + + E_USER_NOTICE + (int) + + + + User-generated notice message. + This is like an E_NOTICE, + except it is generated in PHP code by using the PHP function + trigger_error. + + + Value of the constant: 1024 + + + - - -
+ + + E_USER_DEPRECATED + (int) + + + + User-generated deprecation message. + This is like an E_DEPRECATED, + except it is generated in PHP code by using the PHP function + trigger_error. + + + Value of the constant: 16384 + + + - - 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;. - -
+ + + E_STRICT + (int) + + + + Run-time suggestions emitted by PHP about the executed code + to ensure forward compatibility. + + + Value of the constant: 2048 + + + + This error level is unused, + and has been deprecated as of PHP 8.4.0. + + + + + + + + E_RECOVERABLE_ERROR + (int) + + + + Legacy engine "exceptions" which correspond to catchable fatal error. + Similar to Error but must be caught via a + user defined error handler (see set_error_handler). + If not handled, this behaves like E_ERROR. + + + Value of the constant: 4096 + + + + This error level is effectively unused, + the only case where this can happen is when interpreting an + &object; as a bool fails. + This can only happen for internal objects. + + + The most common example, prior to PHP 8.4.0, is using a + GMP instance in a conditional. + + + + + + + + E_ALL + (int) + + + + Bit-mask that contains every single error, warning, and notice. + + + Value of the constant: 32767 + + + + +