Skip to content

Commit 71e109b

Browse files
authored
Merge pull request #646 from Automattic/silence_fclose
Silence WordPress.WP.AlternativeFunctions.file_system_read_fclose
2 parents 66bf0a9 + d988322 commit 71e109b

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

WordPress-VIP-Go/ruleset-test.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ $x = sanitize_key( $_COOKIE['bar'] ); // phpcs:ignore WordPress.Security.Validat
5656
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'some_value' ) { // Error.
5757
}
5858

59-
// WordPress.WP.AlternativeFunctions.file_system_read_fclose
60-
fclose( $fp ); // Warning + Message.
59+
60+
6161

6262
// WordPress.WP.AlternativeFunctions.file_system_read_fopen
6363
fopen( 'file.txt', 'r' ); // Warning + Message.

WordPress-VIP-Go/ruleset-test.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133
41 => 1,
134134
44 => 1,
135135
47 => 1,
136-
60 => 1,
137136
63 => 1,
138137
66 => 1,
139138
85 => 1,
@@ -293,9 +292,6 @@
293292
56 => [
294293
'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.',
295294
],
296-
60 => [
297-
'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as fclose(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/',
298-
],
299295
63 => [
300296
'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as fopen(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/',
301297
],

WordPress-VIP-Go/ruleset.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@
112112
<rule ref="WordPress.WP.AlternativeFunctions.file_system_read_fopen">
113113
<message>File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/</message>
114114
</rule>
115-
<rule ref="WordPress.WP.AlternativeFunctions.file_system_read_fclose">
116-
<message>File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/</message>
117-
</rule>
118115
<rule ref="WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown">
119116
<message>%s() is uncached. If the function is being used to fetch a remote file (e.g. a URL starting with https://), please use wpcom_vip_file_get_contents() to ensure the results are cached. For more details, please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/</message>
120117
</rule>
@@ -288,5 +285,8 @@
288285
<rule ref="WordPress.WP.AlternativeFunctions.file_system_read_readfile">
289286
<severity>0</severity>
290287
</rule>
288+
<rule ref="WordPress.WP.AlternativeFunctions.file_system_read_fclose">
289+
<severity>0</severity>
290+
</rule>
291291

292292
</ruleset>

0 commit comments

Comments
 (0)