#29312 [Opn->Fbk]: set_exception_handler does not work correctly
| From: | curt@php.net | Date: | Fri, 10 Sep 2004 03:38:29 +0000 |
| Subject: | #29312 [Opn->Fbk]: set_exception_handler does not work correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65977@lists.php.net to get a copy of this message | ||
ID: 29312
Updated by: curt@php.net
Reported By: davey@php.net
-Status: Open
+Status: Feedback
Bug Type: Zend Engine 2 problem
Operating System: WinXP w/SP1
PHP Version: 5.0.0
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2004-07-22 00:09:34] davey@php.net
Description:
------------
When supplying an object/method callback for set_exception_handler it
does not work if no exception message is passed. If you use a function
of a static method it works fine.
If you pass a message, it also works as expected
- Davey
Reproduce code:
---------------
<?php
class exception_handler {
function handle_exception($exception) {
var_dump($exception);
}
}
$exception_handler = new exception_handler;
set_exception_handler(array($exception_handler, 'handle_exception'));
throw new Exception;
?>
Expected result:
----------------
object(Exception)#1 (6) {
["message:protected"]=>
string(0) ""
["string:private"]=>
string(0) ""
["code:protected"]=>
int(0)
["file:protected"]=>
string(53) "D:\web\php-mag\shafikdavey_errorhandling\listing2.txt"
["line:protected"]=>
int(12)
["trace:private"]=>
array(0) {
}
}
Actual result:
--------------
<br />
<b>Fatal error</b>: Uncaught exception 'Exception' in
D:\web\php-mag\shafikdavey_errorhandling\listing2.txt:12
Stack trace:
#0 {main}
thrown in
<b>D:\web\php-mag\shafikdavey_errorhandling\listing2.txt</b> on line
<b>12</b><br />
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29312&edit=1