php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30635 exception handler does not work
Submitted: 2004-10-31 23:53 UTC Modified: 2004-11-17 01:29 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: support at malyweb dot cz Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2004-10-31 (dev) OS: winXp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: support at malyweb dot cz
New email:
PHP Version: OS:

 

 [2004-10-31 23:53 UTC] support at malyweb dot cz
Description:
------------
the code below causes that window critical error dialog appear and no result is shown
I tried it on 5.0.2 - it did not work so I downloaded this latest version (5.0.3-dev) and it is still not working.

(I read this one also: http://bugs.php.net/bug.php?id=30230 but actually do not understand it - the code is not working also)

btw: this works fine
function exceptionHandler($exception){
echo('Uncaught exception: '.$exception->getMessage());
}
set_exception_handler('exceptionHandler');
throw new Exception('oh no ... ;)');exit;

Reproduce code:
---------------
<?php
class core_exception {
	public static function exceptionHandler($exception){
		echo('Uncaught exception: '.$exception->getMessage());
	}
}
$_EXCEPTION = new core_exception();
set_exception_handler(array($_EXCEPTION,'exceptionHandler'));
throw new Exception('oh no ... ;)');exit;
?>


Expected result:
----------------
Uncaught exception: oh no ... ;)

Actual result:
--------------
via browser: no result + critical error of apache
via cmdline: no result + critical error of CLI or CGI/FastCGI 

via zde debugger: shows the expected result (build 1482)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-01 00:11 UTC] support at malyweb dot cz
just some more info:
I've just downgraded php back to 5.0.2 - the difference is, that the code sometimes (irregulary :/) shows the expected result and "Fatal error: Uncaught exception 'Exception' with message 'oh no ... ;)' in ..."

I wonder how is that possible - I have tried IE and Mozilla (i've suspected the cache for a while)

the windowsXP built-in firewall is off
 [2004-11-04 16:03 UTC] thekid@php.net
Cannot reproduce (CLI, FreeBSD):

$ cat test.php 
<?php
  class core_exception {
    public function exceptionHandler($exception){
      echo 'Uncaught exception: ', $exception->getMessage(), "\n";
    }
  }

  set_exception_handler(array(new core_exception(), 'exceptionHandler'));
  throw new Exception('oh no ... ;)');
?>
$ php5 test.php 
Uncaught exception: oh no ... ;)

 [2004-11-04 21:07 UTC] support at malyweb dot cz
the code does not work:

win XP, php 5.0.2: irregularly 
Fatal error: Uncaught exception 'Exception' with message 'oh no ... ;)' in C:\...\html\test.php:11 Stack trace: #0 {main} thrown in C:\...\html\test.php on line 11

OR

Uncaught exception: oh no ... ;) 

win2000, php5.0.1 (maybe irrelevant): only the first one

both is apache 2.0.52
 [2004-11-17 01:25 UTC] support at malyweb dot cz
code is working fine now (I always get the expected result), nice work ...
 [2004-11-17 01:29 UTC] support at malyweb dot cz
sorry, i just close this report ...
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Mar 03 03:01:24 2021 UTC