php.net |  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
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: artaxerxes2 at iname dot com
New email:
PHP Version: OS:

 

 [2012-10-05 16:02 UTC] artaxerxes2 at iname dot com
Description:
------------
Following the code from http://www.php.net/manual/en/function.set-error-handler.php#109149

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-08 03:22 UTC] laruence@php.net
-Status: Open +Status: Duplicate
 [2012-10-08 03:22 UTC] laruence@php.net
dup to #62985
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 21:03:45 2021 UTC