From d9883220836ea5e1a58bbbcadb54935f247a7d57 Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Mon, 29 Mar 2021 09:51:11 -0600 Subject: [PATCH] Silence WordPress.WP.AlternativeFunctions.file_system_read_fclose x --- WordPress-VIP-Go/ruleset-test.inc | 4 ++-- WordPress-VIP-Go/ruleset-test.php | 4 ---- WordPress-VIP-Go/ruleset.xml | 6 +++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/WordPress-VIP-Go/ruleset-test.inc b/WordPress-VIP-Go/ruleset-test.inc index 63c110dc..6867c45e 100644 --- a/WordPress-VIP-Go/ruleset-test.inc +++ b/WordPress-VIP-Go/ruleset-test.inc @@ -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. diff --git a/WordPress-VIP-Go/ruleset-test.php b/WordPress-VIP-Go/ruleset-test.php index 1bcd34a5..462bea51 100644 --- a/WordPress-VIP-Go/ruleset-test.php +++ b/WordPress-VIP-Go/ruleset-test.php @@ -133,7 +133,6 @@ 41 => 1, 44 => 1, 47 => 1, - 60 => 1, 63 => 1, 66 => 1, 85 => 1, @@ -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/', ], diff --git a/WordPress-VIP-Go/ruleset.xml b/WordPress-VIP-Go/ruleset.xml index cdb48109..1d524e18 100644 --- a/WordPress-VIP-Go/ruleset.xml +++ b/WordPress-VIP-Go/ruleset.xml @@ -112,9 +112,6 @@ 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/ - - 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/ - %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/ @@ -288,5 +285,8 @@ 0 + + 0 +