downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.restore-error-handler.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.errorfunc.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.restore-error-handler.php',
   
1 => 'restore_error_handler',
  ),
 
'up' =>
  array (
   
0 => 'ref.errorfunc.php',
   
1 => 'Error Handling Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.error-reporting.php',
   
1 => 'error_reporting',
  ),
 
'next' =>
  array (
   
0 => 'function.restore-exception-handler.php',
   
1 => 'restore_exception_handler',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.restore-error-handler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">restore_error_handler</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.1, PHP 5)</p><p class="refpurpose"><span class="refname">restore_error_handler</span> &mdash; <span class="dc-title">Restores the previous error handler function</span></p>

 </div>

 <a name="function.restore-error-handler.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><b>restore_error_handler</b></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Used after changing the error handler function using
   <a href="function.set-error-handler.php" class="function">set_error_handler()</a>, to revert to the previous error
   handler (which could be the built-in or a user defined function).
  </p>
 </div>


 <a name="function.restore-error-handler.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   This function always returns <b><tt class="constant">TRUE</tt></b>.
  </p>
 </div>


 <a name="function.restore-error-handler.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>restore_error_handler()</b> example</b></p>
    <div class="example-contents para"><p>
     Decide if <a href="function.unserialize.php" class="function">unserialize()</a> caused an error, then
     restore the original error handler.
    </p></div>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">unserialize_handler</span><span style="color: #007700">(</span><span style="color: #0000BB">$errno</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$errstr</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Invalid&nbsp;serialized&nbsp;value.\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$serialized&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">set_error_handler</span><span style="color: #007700">(</span><span style="color: #DD0000">'unserialize_handler'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$original&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">unserialize</span><span style="color: #007700">(</span><span style="color: #0000BB">$serialized</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">restore_error_handler</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents para"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Invalid serialized value.
</pre></div>
    </div>
   </div><p>
  </p>
 </div>


 <a name="function.restore-error-handler.notes"></a><div class="refsect1 notes">
  <h3 class="title">Notes</h3>
  <blockquote><p><b class="note">Note</b>:
  
    Calling <b>restore_error_handler()</b> from the
    <i>error_handler</i> function is ignored.
   <br />
  </p></blockquote>
 </div>


 <a name="function.restore-error-handler.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.error-reporting.php" class="function" rel="rdfs-seeAlso">error_reporting()</a> - Sets which PHP errors are reported</li>
    <li class="member"><a href="function.set-error-handler.php" class="function" rel="rdfs-seeAlso">set_error_handler()</a> - Sets a user-defined error handler function</li>
    <li class="member"><a href="function.restore-exception-handler.php" class="function" rel="rdfs-seeAlso">restore_exception_handler()</a> - Restores the previously defined exception handler function</li>
    <li class="member"><a href="function.trigger-error.php" class="function" rel="rdfs-seeAlso">trigger_error()</a> - Generates a user-level error/warning/notice message</li>
   </ul><p>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites