Exceptions from set_error_handler are not always propagated

Bug #64135 Exceptions from set_error_handler are not always propagated
Submitted: 2013-02-02 16:55 UTC Modified: 2013-02-07 14:26 UTC
From: za_creature at yahoo dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4.11 OS: WOW64, CentOS6.3
Private report: No CVE-ID: None

 [2013-02-02 16:55 UTC] za_creature at yahoo dot com

Description:
------------
echo $undefined works
$undefined++ works
$undefined->method() doesn't


Test script:
---------------
<?php

function exception_error_handler() {
	throw new Exception();
}

set_error_handler("exception_error_handler");
try {
	$undefined->method();
}
catch(Exception $e) {
	echo "Exception is thrown";
}


Expected result:
----------------
Exception is thrown

Actual result:
--------------
PHP Warning:  Uncaught exception 'Exception' in /home/radu/bug.php:4
Stack trace:
#0 /home/radu/bug.php(9): exception_error_handler(8, 'Undefined varia...', 
'/home/radu/bug....', 9, Array)
#1 {main}
  thrown in /home/radu/bug.php on line 4

Warning: Uncaught exception 'Exception' in /home/radu/bug.php:4
Stack trace:
#0 /home/radu/bug.php(9): exception_error_handler(8, 'Undefined varia...', 
'/home/radu/bug....', 9, Array)
#1 {main}
  thrown in /home/radu/bug.php on line 4
PHP Fatal error:  Call to a member function method() on a non-object in 
/home/radu/bug.php on line 9

Patches

bug64135.patch (last revision 2013-02-04 06:56 UTC by laruence@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2013-02-04 07:00 UTC] laruence@php.net

patch attached,  but I think maybe only going into PHP 5.5, this could be 
considered a BC break.

what do you think, dmitry?  thanks

 [2013-02-04 08:12 UTC] dmitry@php.net

I don't see any problems with the patch.