#33771 [Opn]: error_reporting falls to 0 level after some try/catch block

From: Date: Tue, 19 Jul 2005 13:42:42 +0000
Subject: #33771 [Opn]: error_reporting falls to 0 level after some try/catch block
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-82148@lists.php.net to get a copy of this message
 ID:               33771
 Updated by:       derick@php.net
 Reported By:      s6urik at mail dot ee
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Linux
 PHP Version:      5.0.4
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[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)

« previous php.bugs (#82148) next »