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
6 changes: 3 additions & 3 deletions WordPress-VIP-Go/ruleset-test.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$file = ''; $fp = ''; $dir = ''; $test = ''; $bar = ''; $array = []; $query_args = []; $url = ''; $query = ''; $page_title = ''; $true = true; $some_nasty_var = ''; $data = ''; $group = ''; $testing = ''; $needle = ''; $some_var = ''; $blogid = 1; $text = ''; $category_id = 123; $foo = ''; $bar = ''; $var = ''; $wp_rewrite = ''; $count = 1; $loop = 1; $a = ''; $b = ''; $obj = ''; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- All set for VariableAnalysis checks.
// WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_delete
delete( $file ); // Warning + Message.



// WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents
file_put_contents( 'file.txt', '', FILE_APPEND ); // Warning + Message.
Expand Down Expand Up @@ -388,7 +388,7 @@ session_status(); // Error.
session_unregister(); // Error.
session_unset(); // Error.
session_write_close(); // Error.
delete(); // Warning.

file_put_contents( $file, $text, FILE_APPEND ); // Warning.
while ( $count > $loop ) {
if ( flock( $fp, LOCK_EX ) ) { // Warning.
Expand Down
5 changes: 0 additions & 5 deletions WordPress-VIP-Go/ruleset-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
574 => 1,
],
'warnings' => [
4 => 1,
7 => 1,
10 => 1,
14 => 1,
Expand Down Expand Up @@ -199,7 +198,6 @@
322 => 1,
326 => 1,
332 => 1,
391 => 1,
392 => 1,
394 => 1,
395 => 1,
Expand Down Expand Up @@ -237,9 +235,6 @@
556 => 1,
],
'messages' => [
4 => [
'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 delete(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/',
],
7 => [
'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 file_put_contents(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/',
],
Expand Down
5 changes: 0 additions & 5 deletions WordPress-VIP-Go/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
<rule ref="WordPressVIPMinimum"/>

<!-- Things that may be incompatible with the VIP Go infrastructure and needs a dev to review -->
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_delete">
<type>warning</type>
<severity>6</severity>
<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.Functions.RestrictedFunctions.file_ops_file_put_contents">
<type>warning</type>
<severity>6</severity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ public function getGroups() {
'type' => 'error',
'message' => 'Filesystem writes are forbidden, please do not use %s().',
'functions' => [
'delete',
'file_put_contents',
'flock',
'fputcsv',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ while ( $count > $loop ) {

fclose( $fp ); // Ok.

delete(); // Error.

fputcsv(); // Error.
fputs(); // Error.
ftruncate(); // Error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public function getErrorList() {
174 => 1,
175 => 1,
177 => 1,
182 => 1,
183 => 1,
184 => 1,
185 => 1,
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/ruleset-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ session_status(); // Error.
session_unregister(); // Error.
session_unset(); // Error.
session_write_close(); // Error.
delete(); // Error.

file_put_contents( $file, $text, FILE_APPEND ); // Error.
while ( $count > $loop ) {
if ( flock( $fp, LOCK_EX ) ) { // Error.
Expand Down
1 change: 0 additions & 1 deletion WordPressVIPMinimum/ruleset-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
365 => 1,
366 => 1,
367 => 1,
368 => 1,
369 => 1,
371 => 1,
372 => 1,
Expand Down