note 58086 added to function.set-exception-handler
| From: | sean at seanodonnell dot com | Date: | Sun, 23 Oct 2005 23:48:19 +0000 |
| Subject: | note 58086 added to function.set-exception-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97479@lists.php.net to get a copy of this message | ||
Using the 'set_exception_handler' function within a class, the defined
'exception_handler' method must be declared as 'public' or 'static'
(or 'public static').
<?php
class example {
public function __construct() {
@set_exception_handler(array('example', 'exception_handler'));
throw new Exception('DOH!!');
}
public static function exception_handler($exception) {
print "Exception Caught: ". $exception->getMessage() ."\n";
}
}
$example = new example;
echo "Not Executed\n";
?>
Declaring the 'exception_handler' function as 'private' causes a FATAL ERROR.
----
Manual Page -- http://www.php.net/manual/en/function.set-exception-handler.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58086
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58086&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58086&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58086&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58086&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58086&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58086&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58086&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58086&report=yes
Search -- http://master.php.net/manage/user-notes.php