This is a discussion on trouble with set_error_handler() within the PHP Language forums, part of the PHP Programming Forums category; If I call this function at the top of the page, does that mean that the function sendErrorsPhpToPds() is now ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
If I call this function at the top of the page, does that mean that
the function sendErrorsPhpToPds() is now called everytime there is an error? Does this still work if I also go error_reporting(0); ?????? function setErrorHandlingToEmail() { // 11-22-04 - this is listed at the top of configPublicEvents.php and configAdminEvents.php. // The idea here is that we want to send all PHP errors to myself, so I can have a better // idea about where the software is screwing up. $old_error_handler = set_error_handler("sendErrorsPhpToPds"); } |
|
|||
|
lkrubner@geocities.com (lawrence) wrote in message news:<da7e68e8.0411291453.79f15afb@posting.google. com>...
> If I call this function at the top of the page, does that mean that > the function sendErrorsPhpToPds() is now called everytime there is an > error? Does this still work if I also go > error_reporting(0); Did you read the manual? <http://in2.php.net/set_error_handler> Look at the second parameter (PHP5). Custom error handler will _usually_ take precedence except for Fatal, compile and parser errors. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com |
|
|||
|
ng4rrjanbiah@rediffmail.com (R. Rajesh Jeba Anbiah) wrote in message news:<abc4d8b8.0411300044.5ded6573@posting.google. com>...
> lkrubner@geocities.com (lawrence) wrote in message news:<da7e68e8.0411291453.79f15afb@posting.google. com>... > > If I call this function at the top of the page, does that mean that > > the function sendErrorsPhpToPds() is now called everytime there is an > > error? Does this still work if I also go > > error_reporting(0); > > Did you read the manual? <http://in2.php.net/set_error_handler> > Look at the second parameter (PHP5). Custom error handler will > _usually_ take precedence except for Fatal, compile and parser errors. You've got it exactly backwards, near as I can figure. From the site: ---------------- Sets a user function (error_handler) to handle errors in a script. Returns a string containing the previously defined error handler (if any), or FALSE on error. If the previous handler was a class method, this function will return an indexed array with the class and the method name. This function can be used for defining your own way of handling errors during runtime, for example in applications in which you need to do cleanup of data/files when a critical error happens, or when you need to trigger an error under certain conditions (using trigger_error()). |
|
|||
|
lkrubner@geocities.com (lawrence) wrote in message news:<da7e68e8.0411302149.5ba2fdfc@posting.google. com>...
> > > If I call this function at the top of the page, does that mean that > > > the function sendErrorsPhpToPds() is now called everytime there is an > > > error? Does this still work if I also go > > > error_reporting(0); > > > > Did you read the manual? <http://in2.php.net/set_error_handler> > > Look at the second parameter (PHP5). Custom error handler will > > _usually_ take precedence except for Fatal, compile and parser errors. > > You've got it exactly backwards, near as I can figure. From the site: <snip manual part> Glad to see you've analyzed the manual. The next step is "touch and feel"--which is nothing but trying simpler scripts to see how the function really works. Then, you have the answer. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
|||
|
R. Rajesh Jeba Anbiah wrote: > lkrubner@geocities.com (lawrence) wrote in message news:<da7e68e8.0411302149.5ba2fdfc@posting.google. com>... > > > > If I call this function at the top of the page, does that mean that > > > > the function sendErrorsPhpToPds() is now called everytime there is an > > > > error? Does this still work if I also go > > > > error_reporting(0); > > > > > > Did you read the manual? <http://in2.php.net/set_error_handler> > > > Look at the second parameter (PHP5). Custom error handler will > > > _usually_ take precedence except for Fatal, compile and parser errors. > > > > You've got it exactly backwards, near as I can figure. From the site: > <snip manual part> > > Glad to see you've analyzed the manual. The next step is "touch and > feel"--which is nothing but trying simpler scripts to see how the > function really works. Then, you have the answer. Neither of the functions pages on www.php.net have made clear to me if custom error handlers still work when error_reporting is set to 0. I'm wondering if someone on this newsgroup knows the answer to that question. |
|
|||
|
R. Rajesh Jeba Anbiah wrote: > lkrubner@geocities.com (lawrence) wrote in message news:<da7e68e8.0411302149.5ba2fdfc@posting.google. com>... > > > > If I call this function at the top of the page, does that mean that > > > > the function sendErrorsPhpToPds() is now called everytime there is an > > > > error? Does this still work if I also go > > > > error_reporting(0); > > > > > > Did you read the manual? <http://in2.php.net/set_error_handler> > > > Look at the second parameter (PHP5). Custom error handler will > > > _usually_ take precedence except for Fatal, compile and parser errors. > > > > You've got it exactly backwards, near as I can figure. From the site: > <snip manual part> > > Glad to see you've analyzed the manual. The next step is "touch and > feel"--which is nothing but trying simpler scripts to see how the > function really works. Then, you have the answer. > > -- > <?php echo 'Just another PHP saint'; ?> > Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |