Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence WordPress.WP.AlternativeFunctions.file_system_read_fclose #646

Merged
merged 1 commit into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WordPress-VIP-Go/ruleset-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ $x = sanitize_key( $_COOKIE['bar'] ); // phpcs:ignore WordPress.Security.Validat
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'some_value' ) { // Error.
}

// WordPress.WP.AlternativeFunctions.file_system_read_fclose
fclose( $fp ); // Warning + Message.



// WordPress.WP.AlternativeFunctions.file_system_read_fopen
fopen( 'file.txt', 'r' ); // Warning + Message.
Expand Down
4 changes: 0 additions & 4 deletions WordPress-VIP-Go/ruleset-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
41 => 1,
44 => 1,
47 => 1,
60 => 1,
63 => 1,
66 => 1,
85 => 1,
Expand Down Expand Up @@ -293,9 +292,6 @@
56 => [
'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.',
],
60 => [
'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/',
],
63 => [
'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/',
],
Expand Down
6 changes: 3 additions & 3 deletions WordPress-VIP-Go/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@
<rule ref="WordPress.WP.AlternativeFunctions.file_system_read_fopen">
<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>
</rule>
<rule ref="WordPress.WP.AlternativeFunctions.file_system_read_fclose">
<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>
</rule>
<rule ref="WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown">
<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>
</rule>
Expand Down Expand Up @@ -288,5 +285,8 @@
<rule ref="WordPress.WP.AlternativeFunctions.file_system_read_readfile">
<severity>0</severity>
</rule>
<rule ref="WordPress.WP.AlternativeFunctions.file_system_read_fclose">
<severity>0</severity>
</rule>

</ruleset>