note 46322 deleted from function.set-exception-handler by sean
| From: | sean@php.net | Date: | Thu, 07 Oct 2004 02:37:57 +0000 |
| Subject: | note 46322 deleted from function.set-exception-handler by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78107@lists.php.net to get a copy of this message | ||
Note Submitter: php5 at grapio dot nl
----
If I use a function of an object as callback function this doesn't work in this function. I
have object:
<?php
class handler
{
function exception($e)
{
echo $e->getMessage();
}
}
$h = new handler()
set_exception_handler(array(&$h, 'exception'));
?>
It works if I do it as folows:
<?php
class handler
{
function exception($e)
{
echo $e->getMessage();
}
}
$h = new handler()
function exceptionHandler($e)
{
global $h;
$h->exception($e);
}
set_exception_handler('exceptionHandler');
?>
Do I something wrong?