Re: set_exception_handler()

From: Date: Sat, 03 Apr 2004 21:50:52 +0000
Subject: Re: set_exception_handler()
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-8925@lists.php.net to get a copy of this message
Never mind. I checked the source and saw what I was looking for (that the handler also preserves the object instance and not just the method itself). I applied your patch. Thanks. At 11:34 PM 4/3/2004 +0200, Timm Friebe wrote:
On Sat, 2004-04-03 at 21:26, Andi Gutmans wrote: In general, I have no problem with adding this consistency. Where is a reference to $instance held until the exception occurs? What kind of reference? This is what I used to verify the (instance) functionality: <?php class ExceptionHandler {
    protected
      $prefix   = '*** Uncaught exception';
    public function handle($e) {
      printf(
        "%s: %s (%s)\n",
        $this->prefix,
        get_class($e),
        $e->getMessage()
      );
    }
} $handler= new ExceptionHandler(); set_exception_handler(array($handler, 'handle')); throw(new Exception('Test')); ?> Output: *** Uncaught exception: exception (Test) - Timm


« previous php.internals (#8925) next »