mirror of
https://github.com/php/doc-en.git
synced 2026-03-23 23:32:18 +01:00
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 <cmbecker69@gmx.de>
This commit is contained in:
committed by
GitHub
parent
b8cefce033
commit
cb7c0c0654
@@ -3,258 +3,338 @@
|
||||
<appendix xml:id="errorfunc.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
&reftitle.constants;
|
||||
&extension.constants.core;
|
||||
<note>
|
||||
<simpara>
|
||||
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.
|
||||
</simpara>
|
||||
</note>
|
||||
<table xml:id="errorfunc.constants.errorlevels">
|
||||
<title>Errors and Logging</title>
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Value</entry>
|
||||
<entry>Constant</entry>
|
||||
<entry>Description</entry>
|
||||
<entry>Note</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row xml:id="constant.e-error">
|
||||
<entry>1</entry>
|
||||
<entry>
|
||||
<constant>E_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
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.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-warning">
|
||||
<entry>2</entry>
|
||||
<entry>
|
||||
<constant>E_WARNING</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
Run-time warnings (non-fatal errors). Execution of the script is not
|
||||
halted.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-parse">
|
||||
<entry>4</entry>
|
||||
<entry>
|
||||
<constant>E_PARSE</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
Compile-time parse errors. Parse errors should only be generated by
|
||||
the parser.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-notice">
|
||||
<entry>8</entry>
|
||||
<entry>
|
||||
<constant>E_NOTICE</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
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.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-core-error">
|
||||
<entry>16</entry>
|
||||
<entry>
|
||||
<constant>E_CORE_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
Fatal errors that occur during PHP's initial startup. This is like an
|
||||
<constant>E_ERROR</constant>, except it is generated by the core of PHP.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-core-warning">
|
||||
<entry>32</entry>
|
||||
<entry>
|
||||
<constant>E_CORE_WARNING</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
Warnings (non-fatal errors) that occur during PHP's initial startup.
|
||||
This is like an <constant>E_WARNING</constant>, except it is generated
|
||||
by the core of PHP.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-compile-error">
|
||||
<entry>64</entry>
|
||||
<entry>
|
||||
<constant>E_COMPILE_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
Fatal compile-time errors. This is like an <constant>E_ERROR</constant>,
|
||||
except it is generated by the Zend Scripting Engine.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-compile-warning">
|
||||
<entry>128</entry>
|
||||
<entry>
|
||||
<constant>E_COMPILE_WARNING</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
Compile-time warnings (non-fatal errors). This is like an
|
||||
<constant>E_WARNING</constant>, except it is generated by the Zend
|
||||
Scripting Engine.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-user-error">
|
||||
<entry>256</entry>
|
||||
<entry>
|
||||
<constant>E_USER_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
User-generated error message. This is like an
|
||||
<constant>E_ERROR</constant>, except it is generated in PHP code by
|
||||
using the PHP function <function>trigger_error</function>.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-user-warning">
|
||||
<entry>512</entry>
|
||||
<entry>
|
||||
<constant>E_USER_WARNING</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
User-generated warning message. This is like an
|
||||
<constant>E_WARNING</constant>, except it is generated in PHP code by
|
||||
using the PHP function <function>trigger_error</function>.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-user-notice">
|
||||
<entry>1024</entry>
|
||||
<entry>
|
||||
<constant>E_USER_NOTICE</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
User-generated notice message. This is like an
|
||||
<constant>E_NOTICE</constant>, except it is generated in PHP code by
|
||||
using the PHP function <function>trigger_error</function>.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-strict">
|
||||
<entry>2048</entry>
|
||||
<entry>
|
||||
<constant>E_STRICT</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
Enable to have PHP suggest changes
|
||||
to your code which will ensure the best interoperability
|
||||
and forward compatibility of your code.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-recoverable-error">
|
||||
<entry>4096</entry>
|
||||
<entry>
|
||||
<constant>E_RECOVERABLE_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
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
|
||||
<function>set_error_handler</function>), the application aborts as it
|
||||
was an <constant>E_ERROR</constant>.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-deprecated">
|
||||
<entry>8192</entry>
|
||||
<entry>
|
||||
<constant>E_DEPRECATED</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
Run-time notices. Enable this to receive warnings about code
|
||||
that will not work in future versions.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-user-deprecated">
|
||||
<entry>16384</entry>
|
||||
<entry>
|
||||
<constant>E_USER_DEPRECATED</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
User-generated warning message. This is like an
|
||||
<constant>E_DEPRECATED</constant>, except it is generated in PHP code by
|
||||
using the PHP function <function>trigger_error</function>.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
<row xml:id="constant.e-all">
|
||||
<entry>32767</entry>
|
||||
<entry>
|
||||
<constant>E_ALL</constant>
|
||||
(<type>int</type>)
|
||||
</entry>
|
||||
<entry>
|
||||
All errors, warnings, and notices.
|
||||
</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<para>
|
||||
The above values (either numerical or symbolic) are used to build
|
||||
up a bitmask that specifies which errors to report. You can use the
|
||||
<simpara>
|
||||
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
|
||||
<link linkend="language.operators.bitwise">bitwise operators</link>
|
||||
to combine these values or mask out certain types of errors. Note
|
||||
that only '|', '~', '!', '^' and '&' will be understood within
|
||||
&php.ini;.
|
||||
</para>
|
||||
</appendix>
|
||||
to combine these values or mask out certain types of errors.
|
||||
</simpara>
|
||||
|
||||
<tip>
|
||||
<simpara>
|
||||
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
|
||||
<literal>|</literal>,
|
||||
<literal>~</literal>,
|
||||
<literal>^</literal>,
|
||||
<literal>!</literal>,
|
||||
<literal>&</literal>
|
||||
operators are understood within &php.ini;.
|
||||
</simpara>
|
||||
</tip>
|
||||
|
||||
<warning>
|
||||
<simpara>
|
||||
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.
|
||||
</simpara>
|
||||
</warning>
|
||||
|
||||
<variablelist xml:id="errorfunc.constants.errorlevels">
|
||||
<varlistentry xml:id="constant.e-error">
|
||||
<term>
|
||||
<constant>E_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
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.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>1</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-warning">
|
||||
<term>
|
||||
<constant>E_WARNING</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Run-time warnings (non-fatal errors).
|
||||
Execution of the script is not halted.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>2</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-parse">
|
||||
<term>
|
||||
<constant>E_PARSE</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Compile-time parse errors.
|
||||
Parse errors should only be generated by the parser.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>4</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-notice">
|
||||
<term>
|
||||
<constant>E_NOTICE</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
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.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>8</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-core-error">
|
||||
<term>
|
||||
<constant>E_CORE_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Fatal errors that occur during PHP's initial startup.
|
||||
This is like an <constant>E_ERROR</constant>,
|
||||
except it is generated by the core of PHP.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>16</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-core-warning">
|
||||
<term>
|
||||
<constant>E_CORE_WARNING</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Warnings (non-fatal errors) that occur during PHP's initial startup.
|
||||
This is like an <constant>E_WARNING</constant>,
|
||||
except it is generated by the core of PHP.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>32</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-compile-error">
|
||||
<term>
|
||||
<constant>E_COMPILE_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Fatal compile-time errors.
|
||||
This is like an <constant>E_ERROR</constant>,
|
||||
except it is generated by the Zend Scripting Engine.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>64</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-compile-warning">
|
||||
<term>
|
||||
<constant>E_COMPILE_WARNING</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Compile-time warnings (non-fatal errors).
|
||||
This is like an <constant>E_WARNING</constant>,
|
||||
except it is generated by the Zend Scripting Engine.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>128</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-deprecated">
|
||||
<term>
|
||||
<constant>E_DEPRECATED</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Run-time deprecation notices.
|
||||
Enable this to receive warnings about code
|
||||
that will not work in future versions.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>8192</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-user-error">
|
||||
<term>
|
||||
<constant>E_USER_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
User-generated error message.
|
||||
This is like an <constant>E_ERROR</constant>,
|
||||
except it is generated in PHP code by using the PHP function
|
||||
<function>trigger_error</function>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>256</literal>
|
||||
</simpara>
|
||||
<warning>
|
||||
<simpara>
|
||||
Usage of this constant with <function>trigger_error</function> is
|
||||
deprecated as of PHP 8.4.0.
|
||||
It is recommended to either &throw; an <exceptionname>Exception</exceptionname>
|
||||
or call <function>exit</function> instead.
|
||||
</simpara>
|
||||
</warning>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-user-warning">
|
||||
<term>
|
||||
<constant>E_USER_WARNING</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
User-generated warning message.
|
||||
This is like an <constant>E_WARNING</constant>,
|
||||
except it is generated in PHP code by using the PHP function
|
||||
<function>trigger_error</function>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>512</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-user-notice">
|
||||
<term>
|
||||
<constant>E_USER_NOTICE</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
User-generated notice message.
|
||||
This is like an <constant>E_NOTICE</constant>,
|
||||
except it is generated in PHP code by using the PHP function
|
||||
<function>trigger_error</function>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>1024</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-user-deprecated">
|
||||
<term>
|
||||
<constant>E_USER_DEPRECATED</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
User-generated deprecation message.
|
||||
This is like an <constant>E_DEPRECATED</constant>,
|
||||
except it is generated in PHP code by using the PHP function
|
||||
<function>trigger_error</function>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>16384</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-strict">
|
||||
<term>
|
||||
<constant>E_STRICT</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Run-time suggestions emitted by PHP about the executed code
|
||||
to ensure forward compatibility.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>2048</literal>
|
||||
</simpara>
|
||||
<warning>
|
||||
<simpara>
|
||||
This error level is unused,
|
||||
and has been deprecated as of PHP 8.4.0.
|
||||
</simpara>
|
||||
</warning>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-recoverable-error">
|
||||
<term>
|
||||
<constant>E_RECOVERABLE_ERROR</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Legacy engine "exceptions" which correspond to catchable fatal error.
|
||||
Similar to <exceptionname>Error</exceptionname> but must be caught via a
|
||||
user defined error handler (see <function>set_error_handler</function>).
|
||||
If not handled, this behaves like <constant>E_ERROR</constant>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>4096</literal>
|
||||
</simpara>
|
||||
<note>
|
||||
<simpara>
|
||||
This error level is effectively unused,
|
||||
the only case where this can happen is when interpreting an
|
||||
&object; as a <type>bool</type> fails.
|
||||
This can only happen for internal objects.
|
||||
</simpara>
|
||||
<simpara>
|
||||
The most common example, prior to PHP 8.4.0, is using a
|
||||
<classname>GMP</classname> instance in a conditional.
|
||||
</simpara>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="constant.e-all">
|
||||
<term>
|
||||
<constant>E_ALL</constant>
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Bit-mask that contains every single error, warning, and notice.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Value of the constant: <literal>32767</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</appendix>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
|
||||
Reference in New Issue
Block a user