trouble with set_error_handler()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    trouble with set_error_handler()

    If I call this function at the top of the page, does that mean that
    the function sendErrorsPhpTo Pds() is now called everytime there is an
    error? Does this still work if I also go
    error_reporting (0);

    ??????



    function setErrorHandlin gToEmail() {
    // 11-22-04 - this is listed at the top of configPublicEve nts.php and
    configAdminEven ts.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_hand ler = set_error_handl er("sendErrorsP hpToPds");
    }
  • R. Rajesh Jeba Anbiah

    #2
    Re: trouble with set_error_handl er()

    lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0411291453.79f1 5afb@posting.go ogle.com>...[color=blue]
    > If I call this function at the top of the page, does that mean that
    > the function sendErrorsPhpTo Pds() is now called everytime there is an
    > error? Does this still work if I also go
    > error_reporting (0);[/color]

    Did you read the manual? <http://in2.php.net/set_error_handl er>
    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

    Comment

    • lawrence

      #3
      Re: trouble with set_error_handl er()

      ng4rrjanbiah@re diffmail.com (R. Rajesh Jeba Anbiah) wrote in message news:<abc4d8b8. 0411300044.5ded 6573@posting.go ogle.com>...[color=blue]
      > lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0411291453.79f1 5afb@posting.go ogle.com>...[color=green]
      > > If I call this function at the top of the page, does that mean that
      > > the function sendErrorsPhpTo Pds() is now called everytime there is an
      > > error? Does this still work if I also go
      > > error_reporting (0);[/color]
      >
      > Did you read the manual? <http://in2.php.net/set_error_handl er>
      > Look at the second parameter (PHP5). Custom error handler will
      > _usually_ take precedence except for Fatal, compile and parser errors.[/color]

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

      Comment

      • R. Rajesh Jeba Anbiah

        #4
        Re: trouble with set_error_handl er()

        lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0411302149.5ba2 fdfc@posting.go ogle.com>...[color=blue][color=green][color=darkred]
        > > > If I call this function at the top of the page, does that mean that
        > > > the function sendErrorsPhpTo Pds() is now called everytime there is an
        > > > error? Does this still work if I also go
        > > > error_reporting (0);[/color]
        > >
        > > Did you read the manual? <http://in2.php.net/set_error_handl er>
        > > Look at the second parameter (PHP5). Custom error handler will
        > > _usually_ take precedence except for Fatal, compile and parser errors.[/color]
        >
        > You've got it exactly backwards, near as I can figure. From the site:[/color]
        <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/

        Comment

        • lkrubner@geocities.com

          #5
          Re: trouble with set_error_handl er()


          R. Rajesh Jeba Anbiah wrote:[color=blue]
          > lkrubner@geocit ies.com (lawrence) wrote in message[/color]
          news:<da7e68e8. 0411302149.5ba2 fdfc@posting.go ogle.com>...[color=blue][color=green][color=darkred]
          > > > > If I call this function at the top of the page, does that mean[/color][/color][/color]
          that[color=blue][color=green][color=darkred]
          > > > > the function sendErrorsPhpTo Pds() is now called everytime there[/color][/color][/color]
          is an[color=blue][color=green][color=darkred]
          > > > > error? Does this still work if I also go
          > > > > error_reporting (0);
          > > >
          > > > Did you read the manual?[/color][/color][/color]
          <http://in2.php.net/set_error_handl er>[color=blue][color=green][color=darkred]
          > > > Look at the second parameter (PHP5). Custom error handler will
          > > > _usually_ take precedence except for Fatal, compile and parser[/color][/color][/color]
          errors.[color=blue][color=green]
          > >
          > > You've got it exactly backwards, near as I can figure. From the[/color][/color]
          site:[color=blue]
          > <snip manual part>
          >
          > Glad to see you've analyzed the manual. The next step is "touch[/color]
          and[color=blue]
          > feel"--which is nothing but trying simpler scripts to see how the
          > function really works. Then, you have the answer.[/color]

          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.

          Comment

          • lkrubner@geocities.com

            #6
            Re: trouble with set_error_handl er()


            R. Rajesh Jeba Anbiah wrote:[color=blue]
            > lkrubner@geocit ies.com (lawrence) wrote in message[/color]
            news:<da7e68e8. 0411302149.5ba2 fdfc@posting.go ogle.com>...[color=blue][color=green][color=darkred]
            > > > > If I call this function at the top of the page, does that mean[/color][/color][/color]
            that[color=blue][color=green][color=darkred]
            > > > > the function sendErrorsPhpTo Pds() is now called everytime there[/color][/color][/color]
            is an[color=blue][color=green][color=darkred]
            > > > > error? Does this still work if I also go
            > > > > error_reporting (0);
            > > >
            > > > Did you read the manual?[/color][/color][/color]
            <http://in2.php.net/set_error_handl er>[color=blue][color=green][color=darkred]
            > > > Look at the second parameter (PHP5). Custom error handler will
            > > > _usually_ take precedence except for Fatal, compile and parser[/color][/color][/color]
            errors.[color=blue][color=green]
            > >
            > > You've got it exactly backwards, near as I can figure. From the[/color][/color]
            site:[color=blue]
            > <snip manual part>
            >
            > Glad to see you've analyzed the manual. The next step is "touch[/color]
            and[color=blue]
            > 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/[/color]

            Comment

            Working...