|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63225 set_exception_handler fails to register in Interactive Shell
Submitted: 2012-10-05 16:02 UTC Modified: 2012-10-08 03:22 UTC
From: artaxerxes2 at iname dot com Assigned:
Status: Duplicate Package: Unknown/Other Function
PHP Version: Irrelevant OS: Fedora 14
Private report: No CVE-ID: None
 [2012-10-05 16:02 UTC] artaxerxes2 at iname dot com
Following the code from

I ran it on the Interactive Shell instead of a script. The captureNormal method worked, the captureShutdown worked, but the captureException did not.
Yet, the set_exception_handler registered it, just didn't call it.

I run PHP 5.3.8, but cannot test with newer PHP. I read the bug reports and the Changelog and didn't see any mention, so I figure it's a new bug.

Test script:
From command line:
$ echo '<?php function ff($exception){ printf ("I am a handler, got %s\n",$exception->getMessage ()) ;} set_exception_handler ("ff") ; throw new Exception ("blabla") ; echo "This is bad\n" ;' | php

From Interactive Shell (php -a):
php> function ff ($exception) { printf ("I am a handler, got %s\n",$exception->getMessage ()) ;} set_exception_handler ("ff") ; throw new Exception ("blabla") ;

Expected result:
I am a handler, got blabla

Actual result:
PHP Warning:  Uncaught exception 'Exception' with message 'blabla' in php shell code:1
Stack trace:
#0 {main}
  thrown in php shell code on line 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-08 03:22 UTC]
-Status: Open +Status: Duplicate
 [2012-10-08 03:22 UTC]
dup to #62985
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Oct 07 09:05:52 2022 UTC