Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 9385

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Errors in PHP 7</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="language.errors.basics.html">Basics</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="language.exceptions.html">Exceptions</a></div>
 <div class="up"><a href="language.errors.html">Errors</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="language.errors.php7" class="sect1">
 <h2 class="title">Errors in PHP 7</h2>

 <p class="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 <a href="class.error.html" class="classname">Error</a> exceptions.
 </p>

 <p class="para">
  As with normal exceptions, these <a href="class.error.html" class="classname">Error</a> exceptions
  will bubble up until they reach the first matching
  <a href="language.exceptions.html#language.exceptions.catch" class="link"><em>catch</em></a>
  block. If there are no matching blocks, then any default exception handler
  installed with <span class="function"><a href="function.set-exception-handler.html" class="function">set_exception_handler()</a></span> 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.
 </p>

 <p class="para">
  As the <a href="class.error.html" class="classname">Error</a> hierarchy does not inherit from
  <a href="class.exception.html" class="classname">Exception</a>, code that uses
  <code class="code">catch (Exception $e) { ... }</code> blocks to handle uncaught
  exceptions in PHP 5 will find that these <a href="class.error.html" class="classname">Error</a>s are
  not caught by these blocks. Either a <code class="code">catch (Error $e) { ... }</code>
  block or a <span class="function"><a href="function.set-exception-handler.html" class="function">set_exception_handler()</a></span> handler is required.
 </p>

 <div class="sect2" id="language.errors.php7.hierarchy">
  <h3 class="title"><a href="class.error.html" class="classname">Error</a> hierarchy</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara"><a href="class.throwable.html" class="classname">Throwable</a></span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara"><a href="class.error.html" class="classname">Error</a></span>
      <ul class="itemizedlist">
       <li class="listitem">
        <span class="simpara"><a href="class.arithmeticerror.html" class="classname">ArithmeticError</a></span>
        <ul class="itemizedlist">
         <li class="listitem">
          <span class="simpara"><a href="class.divisionbyzeroerror.html" class="classname">DivisionByZeroError</a></span>
         </li>
        </ul>
       </li>
       <li class="listitem">
        <span class="simpara"><a href="class.assertionerror.html" class="classname">AssertionError</a></span>
       </li>
       <li class="listitem">
        <span class="simpara"><a href="class.compileerror.html" class="classname">CompileError</a></span>
        <ul class="itemizedlist">
         <li class="listitem">
          <span class="simpara"><a href="class.parseerror.html" class="classname">ParseError</a></span>
         </li>
        </ul>
       </li>
       <li class="listitem">
        <span class="simpara"><a href="class.typeerror.html" class="classname">TypeError</a></span>
        <ul class="itemizedlist">
         <li class="listitem">
          <span class="simpara"><a href="class.argumentcounterror.html" class="classname">ArgumentCountError</a></span>
         </li>
        </ul>
       </li>
      </ul>
     </li>
     <li class="listitem">
      <span class="simpara"><a href="class.exception.html" class="classname">Exception</a></span>
      <ul class="itemizedlist">
       <li class="listitem">
        <span class="simpara">...</span>
       </li>
      </ul>
     </li>
    </ul>
   </li>
  </ul>
 </div>
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="language.errors.basics.html">Basics</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="language.exceptions.html">Exceptions</a></div>
 <div class="up"><a href="language.errors.html">Errors</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>