reference/errorfunc/functions/set-exception-handler.xml
686b6869e2695d96d0f3a2055cfa629a8b3b1ac7
...
...
@@ -30,9 +30,10 @@
30
30
<listitem>
31
31
<para>
32
32
The function to be called when an uncaught exception occurs.
33
-
Most errors are reported by throwing <classname>Error</classname>
34
-
exceptions, which will be caught by the handler as well. Both <classname>Error</classname>
35
-
and <classname>Exception</classname> implements the <classname>Throwable</classname> interface.
33
+
This handler function needs to accept one parameter,
34
+
which will be the <classname>Throwable</classname> object that was thrown.
35
+
Both <classname>Error</classname> and <classname>Exception</classname>
36
+
implement the <classname>Throwable</classname> interface.
36
37
This is the handler signature:
37
38
</para>
38
39
<para>
...
...
@@ -66,7 +67,7 @@
66
67
<programlisting role="php">
67
68
<![CDATA[
68
69
<?php
69
-
function exception_handler($exception) {
70
+
function exception_handler(Throwable $exception) {
70
71
echo "Uncaught exception: " , $exception->getMessage(), "\n";
71
72
}
72
73

...
...
@@ -88,7 +89,7 @@ echo "Not Executed\n";
88
89
<member><function>restore_exception_handler</function></member>
89
90
<member><function>restore_error_handler</function></member>
90
91
<member><function>error_reporting</function></member>
91
-
<member><link linkend="language.exceptions">PHP 5 Exceptions</link></member>
92
+
<member><link linkend="language.exceptions">Exceptions</link></member>
92
93
</simplelist>
93
94
</para>
94
95
</refsect1><!-- }}} -->
95
96