From cece3be2a98886c7bfb73f653f1a2ecb4d8d1f17 Mon Sep 17 00:00:00 2001
From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com>
Date: Mon, 29 Mar 2021 09:11:35 -0600
Subject: [PATCH 1/2] RestrictedFunctionsSniff: Remove wp_cache_get_multi group
---
WordPress-VIP-Go/ruleset-test.inc | 2 +-
WordPress-VIP-Go/ruleset-test.php | 1 -
.../Sniffs/Functions/RestrictedFunctionsSniff.php | 7 -------
.../Tests/Functions/RestrictedFunctionsUnitTest.inc | 4 ++--
.../Tests/Functions/RestrictedFunctionsUnitTest.php | 1 -
WordPressVIPMinimum/ruleset-test.inc | 2 +-
WordPressVIPMinimum/ruleset-test.php | 1 -
7 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/WordPress-VIP-Go/ruleset-test.inc b/WordPress-VIP-Go/ruleset-test.inc
index a41c38e8..63c110dc 100644
--- a/WordPress-VIP-Go/ruleset-test.inc
+++ b/WordPress-VIP-Go/ruleset-test.inc
@@ -346,7 +346,7 @@ $my_notokay_func = 'extract';
$my_notokay_func(); // Error.
// WordPressVIPMinimum.Functions.RestrictedFunctions
-wp_cache_get_multi(); // Error.
+
opcache_reset(); // Error.
opcache_invalidate( 'test_script.php' ); // Error.
opcache_compile_file( $var ); // Error.
diff --git a/WordPress-VIP-Go/ruleset-test.php b/WordPress-VIP-Go/ruleset-test.php
index 12128b66..1bcd34a5 100644
--- a/WordPress-VIP-Go/ruleset-test.php
+++ b/WordPress-VIP-Go/ruleset-test.php
@@ -37,7 +37,6 @@
341 => 1,
342 => 1,
346 => 1,
- 349 => 1,
350 => 1,
351 => 1,
352 => 1,
diff --git a/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php b/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php
index d12ec448..5c28aef2 100644
--- a/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php
+++ b/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php
@@ -25,13 +25,6 @@ class RestrictedFunctionsSniff extends AbstractFunctionRestrictionsSniff {
public function getGroups() {
$groups = [
- 'wp_cache_get_multi' => [
- 'type' => 'error',
- 'message' => '`%s` is not supported on the WordPress.com VIP platform.',
- 'functions' => [
- 'wp_cache_get_multi',
- ],
- ],
'opcache' => [
'type' => 'error',
'message' => '`%s` is prohibited on the WordPress VIP platform due to memory corruption.',
diff --git a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc
index c1b6e6d1..bb4871dc 100644
--- a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc
+++ b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc
@@ -15,8 +15,8 @@ $allowed_html = [
];
$url = 'http://www.google.ca';
-wp_cache_get_mult(); // Ok - similarly-named function to wp_cache_get_multi().
-wp_cache_get_multi(); // Error.
+
+
opcache_resets(); // Ok - similarly-named custom function to opcache_reset().
opcach_invalidate ( $test_script ); // Ok - similarly-named custom function to opcache_invalidate().
diff --git a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php
index ab1e3334..aca945f6 100644
--- a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php
+++ b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php
@@ -25,7 +25,6 @@ class RestrictedFunctionsUnitTest extends AbstractSniffUnitTest {
*/
public function getErrorList() {
return [
- 19 => 1,
27 => 1,
28 => 1,
29 => 1,
diff --git a/WordPressVIPMinimum/ruleset-test.inc b/WordPressVIPMinimum/ruleset-test.inc
index 9c25a9f9..66e19b48 100644
--- a/WordPressVIPMinimum/ruleset-test.inc
+++ b/WordPressVIPMinimum/ruleset-test.inc
@@ -308,7 +308,7 @@ $my_notokay_func = 'extract';
$my_notokay_func(); // Error.
// WordPressVIPMinimum.Functions.RestrictedFunctions
-wp_cache_get_multi(); // Error.
+
opcache_reset(); // Error.
opcache_invalidate( 'test_script.php' ); // Error.
opcache_compile_file( $var ); // Error.
diff --git a/WordPressVIPMinimum/ruleset-test.php b/WordPressVIPMinimum/ruleset-test.php
index 6f9b8291..e73adb35 100644
--- a/WordPressVIPMinimum/ruleset-test.php
+++ b/WordPressVIPMinimum/ruleset-test.php
@@ -82,7 +82,6 @@
303 => 1,
304 => 1,
308 => 1,
- 311 => 1,
312 => 1,
313 => 1,
314 => 1,
From 43a5830d1c84181ba17ff118742514599352aa13 Mon Sep 17 00:00:00 2001
From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com>
Date: Mon, 29 Mar 2021 09:30:27 -0600
Subject: [PATCH 2/2] Silence
WordPress.WP.AlternativeFunctions.file_system_read_readfile
---
WordPress-VIP-Go/ruleset.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/WordPress-VIP-Go/ruleset.xml b/WordPress-VIP-Go/ruleset.xml
index 52ea12db..cdb48109 100644
--- a/WordPress-VIP-Go/ruleset.xml
+++ b/WordPress-VIP-Go/ruleset.xml
@@ -285,5 +285,8 @@
0
+
+ 0
+