Skip to content

Commit

Permalink
PHP 8.4: trigger_error() updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Girgias committed Nov 13, 2024
1 parent 348789a commit 05ffd3a
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions reference/errorfunc/functions/trigger-error.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
The designated error type for this error. It only works with the <constant>E_USER_<replaceable>*</replaceable></constant>
family of constants, and will default to <constant>E_USER_NOTICE</constant>.
</para>
<warning>
Passing <constant>E_USER_ERROR</constant> as the
<parameter>error_level</parameter> is now deprecated.
Throw an <exceptionname>Exception</exceptionname> or
call <function>exit</function> instead.
</warning>
</listitem>
</varlistentry>
</variablelist>
Expand Down Expand Up @@ -80,6 +86,22 @@
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
Passing <constant>E_USER_ERROR</constant> as the
<parameter>error_level</parameter> is now deprecated.
Throw an <exceptionname>Exception</exceptionname> or
call <function>exit</function> instead.
</entry>
</row>
<row>
<entry>8.4.0</entry>
<entry>
The function now has a return type of <type>true</type>
instead of <type>bool</type>.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Expand All @@ -103,8 +125,8 @@
<programlisting role="php">
<![CDATA[
<?php
if ($divisor == 0) {
trigger_error("Cannot divide by zero", E_USER_ERROR);
if (is_nan($divisor)) {
trigger_error("Cannot divide by NAN", E_USER_WARNING);
}
?>
]]>
Expand Down Expand Up @@ -132,6 +154,7 @@ if ($divisor == 0) {
<member><function>set_error_handler</function></member>
<member><function>restore_error_handler</function></member>
<member>The <link linkend="errorfunc.constants">error level constants</link></member>
<member>The <classname>Deprecated</classname> attribute</member>
</simplelist>
</para>
</refsect1>
Expand Down

0 comments on commit 05ffd3a

Please sign in to comment.