Skip to content
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
3 changes: 3 additions & 0 deletions WordPress-VIP-Go/ruleset-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,7 @@ delete_site_option( $foo ); // Ok.
// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_update_site_option
update_site_option( $bar, $foo, true ); // Ok.

// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_add_site_option
add_site_option( 'foo', $bar ); // Ok.

?> <!-- closing PHP tag should be omitted -->
3 changes: 3 additions & 0 deletions WordPress-VIP-Go/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,8 @@
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_update_site_option">
<severity>0</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_add_site_option">
<severity>0</severity>
</rule>

</ruleset>
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public function getGroups() {
'type' => 'error',
'message' => '%s() will overwrite network option values, please use the `*_option()` equivalent instead (e.g. `update_option()`).',
'functions' => [
'add_site_option',
'update_site_option',
'delete_site_option',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,9 @@ $c->create_function = 'bar' . ( 1 === 1 ?? 'foo' ); // Ok.
$wp_random_testing = create_function2( '$a, $b', 'return ( $b / $a ); '); // Ok.
$wp_random_testing = create_function3( '$a, $b', 'return ( $b / $a ); '); // Ok.

add_site_option( $foo, 'bar' ); // Warning.
add_option( $foo, 'bar' ); // Ok.
update_site_option( $bar, 'foo' ); // Warning.
update_option( 'foo', $bar ); // Ok.
delete_site_option( $foo ); // Warning.
delete_option( $bar ); // Ok.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ public function getErrorList() {
198 => 1,
199 => 1,
200 => 1,
218 => 1,
220 => 1,
222 => 1,
];
}

Expand Down
9 changes: 9 additions & 0 deletions WordPressVIPMinimum/ruleset-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,13 @@ add_filter( 'cron_schedules', 'my_add_weekly' ); // Error. 6 min.

thisisasyntaxerror! // Error.

// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_add_site_option
add_site_option( 'foo', $bar ); // Error.

// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_update_site_option
update_site_option( $bar, $foo, true ); // Error.

// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_delete_site_option
delete_site_option( $foo ); // Error.

?> <!-- closing PHP tag should be omitted -->
3 changes: 3 additions & 0 deletions WordPressVIPMinimum/ruleset-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
168 => 1,
172 => 1,
180 => 1,
183 => 1,
186 => 1,
189 => 1,
],
'warnings' => [
18 => 1,
Expand Down