#33771 [Asn->Csd]: error_reporting falls to 0 level after some try/catch block
ID: 33771
Updated by: tony2001@php.net
Reported By: s6urik at mail dot ee
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.1.* (2005-07-30)
Assigned To: tony2001
New Comment:
Fixed in 5.1 and HEAD.
Previous Comments:
------------------------------------------------------------------------
[2005-09-20 22:00:00] tony2001@php.net
Reassigned to myself so I won't forget to commit the patch..
------------------------------------------------------------------------
[2005-07-21 12:21:30] dmitry@php.net
The fix is near impossible with current implementation.
May be it could be fixed in future version of PHP with try/funally.
BTW, we decide not to include try/finally into PHP 5.1.
------------------------------------------------------------------------
[2005-07-19 15:48:08] tony2001@php.net
Dmitry, could you check it plz?
------------------------------------------------------------------------
[2005-07-19 15:42:40] derick@php.net
I'm not sure if we can qualify this as a bug actually. But atleast I
can offer an explanation. If you use @ the error reporting level will
be set to 0 before an expression (make_exception()) and set's it back
to the original value after it. Because the throwing of the exception
immediately jumps to the catch block, the error reporting level is not
reset back to it's old value. I'm not sure how easy this is to fix.
------------------------------------------------------------------------
[2005-07-19 15:33:13] s6urik at mail dot ee
Description:
------------
If exception is throwed with error suppression (@) and catched by
try/catch block error_reporting will fall to 0
Reproduce code:
---------------
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
echo "1. error_reporting = " . error_reporting() . "\n";
function make_exception()
{
throw new Exception();
}
try {
@make_exception();
} catch (Exception $e) {}
echo "2. error_reporting = " . error_reporting() . "\n";
Expected result:
----------------
1. error_reporting = 4095
2. error_reporting = 4095
Actual result:
--------------
1. error_reporting = 4095
2. error_reporting = 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33771&edit=1
Thread (6 messages)