You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fix the title to match the sniff name.
- Be specific about the @ operator in the standard description.
- Mention the exception for certain functions without listing them.
- Simplify the code examples to focus on the presence/absence of @.
- Rename the variable from $conn_id to $connection as
`ftp_connect()` does not return a connection ID.
title="Discourage the use of the PHP error silencing operator"
4
+
title="No Silenced Errors"
5
5
>
6
6
<standard>
7
7
<![CDATA[
8
-
Silencing errors is strongly discouraged. Use proper error checking instead.
9
-
10
-
Using the error operator with certain functions is allowed because no amount of error checking can fully prevent PHP from throwing errors when these functions are executed. The functions where this is permitted include, but are not limited to:
11
-
12
-
- `file_exists()`
13
-
- `file_get_contents()`
14
-
- `filesize()`
15
-
- `filetype()`
16
-
- `fopen()`
17
-
- `ftp_login()`
18
-
- `ftp_rename()`
8
+
The error silencing operator (@) should not be used. As an exception, the operator is allowed for certain functions where errors cannot be prevented through error checking.
19
9
]]>
20
10
</standard>
21
11
<code_comparison>
22
-
<codetitle="Valid: Using proper error checking when calling functions not in the allowed list.">
12
+
<codetitle="Valid: Calling a function without error silencing.">
0 commit comments