By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,714 Members | 1,299 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,714 IT Pros & Developers. It's quick & easy.

error handler

P: n/a
In my code I have a block like this
----------------------------------------------------------------------
$old_error_handler = set_error_handler('HLErrorHandler');
// some code
restore_error_handler();
//some code
$old_error_handler = set_error_handler('HLErrorHandler');
----------------------------------------------------------------------

once I call the function 'restore_error_handler()' I can't set the error
handler back to ''HLErrorHandler''.
Does anyone know why?
Any Help would be appreciated

Jeremy Shovan
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Wed, 13 Oct 2004 22:25:50 -0700, "Jeremy Shovan"
<je********@foundationx.com> wrote:
In my code I have a block like this
----------------------------------------------------------------------
$old_error_handler = set_error_handler('HLErrorHandler');
// some code
restore_error_handler();
//some code
$old_error_handler = set_error_handler('HLErrorHandler');
----------------------------------------------------------------------

once I call the function 'restore_error_handler()' I can't set the error
handler back to ''HLErrorHandler''.
Does anyone know why?


Nope - it works for me. What does your code do? What version of PHP? Can you
give an actual example - the code you posted doesn't demonstrate the problem
since there's no definition of the error handler itself.

<pre>
<?php
function HLErrorHandler($errno, $errstr, $errfile, $errline)
{
print "kerplunk\n";
}

$old_error_handler = set_error_handler('HLErrorHandler');
trigger_error("boink", E_USER_NOTICE);
restore_error_handler();
trigger_error("boink", E_USER_NOTICE);
$old_error_handler = set_error_handler('HLErrorHandler');
trigger_error("boink", E_USER_NOTICE);
?>
</pre>

Outputs:
kerplunk

Notice: boink in D:\public_html\test.php on line 11

kerplunk

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.