error handler

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

    error handler

    In my code I have a block like this
    ----------------------------------------------------------------------
    $old_error_hand ler = set_error_handl er('HLErrorHand ler');
    // some code
    restore_error_h andler();
    //some code
    $old_error_hand ler = set_error_handl er('HLErrorHand ler');
    ----------------------------------------------------------------------

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

    Jeremy Shovan


  • Andy Hassall

    #2
    Re: error handler

    On Wed, 13 Oct 2004 22:25:50 -0700, "Jeremy Shovan"
    <jeremys013@fou ndationx.com> wrote:
    [color=blue]
    >In my code I have a block like this
    >----------------------------------------------------------------------
    >$old_error_han dler = set_error_handl er('HLErrorHand ler');
    >// some code
    >restore_error_ handler();
    >//some code
    >$old_error_han dler = set_error_handl er('HLErrorHand ler');
    >----------------------------------------------------------------------
    >
    >once I call the function 'restore_error_ handler()' I can't set the error
    >handler back to ''HLErrorHandle r''.
    >Does anyone know why?[/color]

    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_hand ler = set_error_handl er('HLErrorHand ler');
    trigger_error(" boink", E_USER_NOTICE);
    restore_error_h andler();
    trigger_error(" boink", E_USER_NOTICE);
    $old_error_hand ler = set_error_handl er('HLErrorHand ler');
    trigger_error(" boink", E_USER_NOTICE);
    ?>
    </pre>

    Outputs:


    kerplunk

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

    kerplunk

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    Working...