Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set_error_handler doesn't work sometimes

Status
Not open for further replies.

russellr

Programmer
Sep 11, 2001
7
AU
I've created an error handler (PHP version is 4.0.6) and it works fine for errors I trigger and for E_NOTICES.

However, if I do this:
Code:
<? xxx(); ?>

where xxx is an undefined function, I get the PHP error message instead of my error handler being called.

Does anyone know why?
 
you should not user set_error_handler.

It has been known to be very buggy, including seg faults in Apache/PHP, Zend problems, and fails to return errors on many occassions.

You should create your own error handling class and just make calls to functions such as:

if(!$fp = fopen......) {
error_handler(&quot;could not open.....&quot;,__LINE__,__FILE__);
}

or you can use PEAR's error handling functionality.

Chad. ICQ: 54380631
online.dll
 
Thanks. I've found some doco which describes the bugs in set_error_handler.

I'm trying to catch my PHP programming errors and to do something friendly when they happen.

It looks like I'll just have to wait until a later release.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top