|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-06 16:16 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 11:00:01 2025 UTC |
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)