Re: set_exception_handler()
| From: | Timm Friebe | Date: | Sat, 03 Apr 2004 21:34:47 +0000 |
| Subject: | Re: set_exception_handler() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8924@lists.php.net to get a copy of this message | ||
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