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

From: Date: Tue, 19 Jul 2005 13:48:09 +0000
Subject: #33771 [Opn->Asn]: 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-82150@lists.php.net to get a copy of this message
ID: 33771 Updated by: tony2001@php.net Reported By: s6urik at mail dot ee -Status: Open +Status: Assigned Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.0.4 -Assigned To: +Assigned To: dmitry New Comment: Dmitry, could you check it plz? Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#82150) next »