php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29312 set_exception_handler does not work correctly
Submitted: 2004-07-22 00:09 UTC Modified: 2004-09-18 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: davey@php.net Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.0 OS: WinXP w/SP1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: davey@php.net
New email:
PHP Version: OS:

 

 [2004-07-22 00:09 UTC] 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 />


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-10 05:38 UTC] curt@php.net
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
 [2004-09-18 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC