note 46322 added to function.set-exception-handler
| From: | php5atgrapiodotnl at osu1 dot php dot net | Date: | Thu, 07 Oct 2004 02:34:51 +0000 |
| Subject: | note 46322 added to function.set-exception-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78106@lists.php.net to get a copy of this message | ||
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?
----
Manual Page -- http://www.php.net/manual/en/function.set-exception-handler.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46322
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46322&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46322&report=yes
Search -- http://master.php.net/manage/user-notes.php