trouble with set_error_handler()

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-29-2004
lawrence
 
Posts: n/a
Default trouble with set_error_handler()

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");
}
Reply With Quote
  #2 (permalink)  
Old 11-30-2004
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: trouble with set_error_handler()

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
Reply With Quote
  #3 (permalink)  
Old 12-01-2004
lawrence
 
Posts: n/a
Default Re: trouble with set_error_handler()

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()).
Reply With Quote
  #4 (permalink)  
Old 12-01-2004
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: trouble with set_error_handler()

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/
Reply With Quote
  #5 (permalink)  
Old 12-02-2004
lkrubner@geocities.com
 
Posts: n/a
Default Re: trouble with set_error_handler()


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.

Reply With Quote
  #6 (permalink)  
Old 12-02-2004
lkrubner@geocities.com
 
Posts: n/a
Default Re: trouble with set_error_handler()


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/


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:18 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0