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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 08:01:32 2025 UTC