Skip to content

Commit 761f713

Browse files
committed
Fix GH-1182: constant() throws Error exception as of PHP 8.0.0
1 parent 39247cb commit 761f713

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

reference/misc/functions/constant.xml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,43 @@
4646
<refsect1 role="returnvalues">
4747
&reftitle.returnvalues;
4848
<para>
49-
Returns the value of the constant, or &null; if the constant is not
50-
defined.
49+
Returns the value of the constant.
5150
</para>
5251
</refsect1>
5352

5453
<refsect1 role="errors">
5554
&reftitle.errors;
5655
<para>
57-
An <constant>E_WARNING</constant> level error is generated if the
58-
constant is not defined.
56+
An <classname>Error</classname> exception is thrown,
57+
if the constant is not defined. Prior to PHP 8.0.0,
58+
an <constant>E_WARNING</constant> level error was generated in that case.
5959
</para>
6060
</refsect1>
6161

62+
<refsect1 role="changelog">
63+
&reftitle.changelog;
64+
<informaltable>
65+
<tgroup cols="2">
66+
<thead>
67+
<row>
68+
<entry>&Version;</entry>
69+
<entry>&Description;</entry>
70+
</row>
71+
</thead>
72+
<tbody>
73+
<row>
74+
<entry>8.0.0</entry>
75+
<entry>
76+
If the constant is not defined, <function>constant</function> now throws an
77+
<classname>Error</classname> exception; previously an <constant>E_WARNING</constant>
78+
was generated, and &null; was returned.
79+
</entry>
80+
</row>
81+
</tbody>
82+
</tgroup>
83+
</informaltable>
84+
</refsect1>
85+
6286
<refsect1 role="examples">
6387
&reftitle.examples;
6488
<para>

0 commit comments

Comments
 (0)