mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00

Based on a patch provided by Huiren Woo. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345757 c90b9560-bf6c-de11-be94-00142212c4b1
105 lines
3.2 KiB
XML
105 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<sect1 xml:id="language.errors.php7" xmlns="http://docbook.org/ns/docbook">
|
|
<title>Errors in PHP 7</title>
|
|
|
|
<para>
|
|
PHP 7 changes how most errors are reported by PHP. Instead of reporting
|
|
errors through the traditional error reporting mechanism used by PHP 5, most
|
|
errors are now reported by throwing <classname>Error</classname> exceptions.
|
|
</para>
|
|
|
|
<para>
|
|
As with normal exceptions, these <classname>Error</classname> exceptions
|
|
will bubble up until they reach the first matching
|
|
<link linkend="language.exceptions.catch"><literal>catch</literal></link>
|
|
block. If there are no matching blocks, then any default exception handler
|
|
installed with <function>set_exception_handler</function> will be called,
|
|
and if there is no default exception handler, then the exception will be
|
|
converted to a fatal error and will be handled like a traditional error.
|
|
</para>
|
|
|
|
<para>
|
|
As the <classname>Error</classname> hierarchy does not inherit from
|
|
<classname>Exception</classname>, code that uses
|
|
<code>catch (Exception $e) { ... }</code> blocks to handle uncaught
|
|
exceptions in PHP 5 will find that these <classname>Error</classname>s are
|
|
not caught by these blocks. Either a <code>catch (Error $e) { ... }</code>
|
|
block or a <function>set_exception_handler</function> handler is required.
|
|
</para>
|
|
|
|
<sect2 xml:id="language.errors.php7.hierarchy">
|
|
<title><classname>Error</classname> hierarchy</title>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><classname>Throwable</classname></simpara>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><classname>Error</classname></simpara>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><classname>ArithmeticError</classname></simpara>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><classname>DivisionByZeroError</classname></simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><classname>AssertionError</classname></simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><classname>CompileError</classname></simpara>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><classname>ParseError</classname></simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><classname>TypeError</classname></simpara>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><classname>ArgumentCountError</classname></simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><classname>Exception</classname></simpara>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>...</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</sect2>
|
|
</sect1>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|