#34761 [NEW]: error_reporting() interferes @ operator

From: Date: Thu, 06 Oct 2005 14:11:11 +0000
Subject: #34761 [NEW]: error_reporting() interferes @ operator
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86132@lists.php.net to get a copy of this message
From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.1.0RC1 PHP Bug Type: Feature/Change Request Bug description: error_reporting() interferes @ operator Description: ------------ Setting a level of error reporting by a call to error_reporting(value) function interferes with @ operator, ie. if the value is >0 error messages are generated even within the scope of @ operator. This behavior contradicts a statement made by manual about @ operator: "When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored." I would expect error messages to be ignored throughout an entire scope of the @ operator regardless of operations performed there. The following example is quite artificial, however there may be situations one would like to have a function changing various configuration options including error reporting level. When he or she also wants to disable all warnings made by this function (or some of its caller) a problem arises. Reproduce code: --------------- <? function f() { var_dump(error_reporting(E_ALL)); var_dump(error_reporting()); array_fill(-1,-1,-1); // deliberately invalid arguments @f(); var_dump(error_reporting()); ?> Expected result: ---------------- int(0) int(0) int(2047) Actual result: -------------- int(0) int(2047) Warning: array_fill(): Number of elements must be positive in ... int(2047) -- Edit bug report at http://bugs.php.net/?id=34761&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34761&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34761&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34761&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34761&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34761&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34761&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34761&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34761&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34761&r=support Expected behavior: http://bugs.php.net/fix.php?id=34761&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34761&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34761&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34761&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34761&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34761&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34761&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34761&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34761&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34761&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34761&r=mysqlcfg

« previous php.bugs (#86132) next »