#34761 [Opn->Csd]: error_reporting() interferes @ operator
| From: | tony2001@php.net | Date: | Thu, 06 Oct 2005 14:16:11 +0000 |
| Subject: | #34761 [Opn->Csd]: error_reporting() interferes @ operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86133@lists.php.net to get a copy of this message | ||
ID: 34761
Updated by: tony2001@php.net
Reported By: tomas_matousek at hotmail dot com
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: WinXP
PHP Version: 5.1.0RC1
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Fixed in CVS about a week ago.
Try fresh snapshots before reporting.
Previous Comments:
------------------------------------------------------------------------
[2005-10-06 16:11:10] tomas_matousek at hotmail dot com
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 this bug report at http://bugs.php.net/?id=34761&edit=1