1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-26 16:52:25 +01:00

Fix GH-1182: constant() throws Error exception as of PHP 8.0.0

This commit is contained in:
Christoph M. Becker
2021-12-08 13:53:14 +01:00
parent 39247cb926
commit 761f713125

View File

@@ -46,19 +46,43 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the value of the constant, or &null; if the constant is not
defined.
Returns the value of the constant.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
An <constant>E_WARNING</constant> level error is generated if the
constant is not defined.
An <classname>Error</classname> exception is thrown,
if the constant is not defined. Prior to PHP 8.0.0,
an <constant>E_WARNING</constant> level error was generated in that case.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
If the constant is not defined, <function>constant</function> now throws an
<classname>Error</classname> exception; previously an <constant>E_WARNING</constant>
was generated, and &null; was returned.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>