Skip to content

Commit

Permalink
Merge pull request #646 from WordPress/643-update-ValidatedSanitizedI…
Browse files Browse the repository at this point in the history
…nput-rule

Change error type for ValidatedSanitizedInput rule
  • Loading branch information
ernilambar authored Sep 19, 2024
2 parents c187c17 + f232cd1 commit 6d83e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions phpcs-rulesets/plugin-review.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@

<!-- Sanitized Input rules -->
<rule ref="WordPress.Security.ValidatedSanitizedInput">
<type>error</type>
<severity>7</severity>
<type>warning</type>
</rule>

<!-- Prohibit the use of the backtick operator. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ public function test_run_with_errors() {
$this->assertArrayHasKey( 'code', $errors['load.php'][12][5][0] );
$this->assertEquals( 'WordPress.WP.DeprecatedFunctions.the_author_emailFound', $errors['load.php'][12][5][0]['code'] );

// Check for WordPress.Security.ValidatedSanitizedInput.InputNotValidated error on Line no 15 and column no at 27.
$this->assertArrayHasKey( 15, $errors['load.php'] );
$this->assertArrayHasKey( 27, $errors['load.php'][15] );
$this->assertArrayHasKey( 'code', $errors['load.php'][15][27][0] );
$this->assertEquals( 'WordPress.Security.ValidatedSanitizedInput.InputNotValidated', $errors['load.php'][15][27][0]['code'] );
// Check for WordPress.Security.ValidatedSanitizedInput warnings on Line no 15 and column no at 27.
$this->assertCount( 1, wp_list_filter( $warnings['load.php'][15][27], array( 'code' => 'WordPress.Security.ValidatedSanitizedInput.InputNotValidated' ) ) );
$this->assertCount( 1, wp_list_filter( $warnings['load.php'][15][27], array( 'code' => 'WordPress.Security.ValidatedSanitizedInput.MissingUnslash' ) ) );
$this->assertCount( 1, wp_list_filter( $warnings['load.php'][15][27], array( 'code' => 'WordPress.Security.ValidatedSanitizedInput.InputNotSanitized' ) ) );

// Check for Squiz.PHP.DiscouragedFunctions.Discouraged warning on Line no 17 and column no at 1.
$this->assertSame( 'Squiz.PHP.DiscouragedFunctions.Discouraged', $warnings['load.php'][17][1][0]['code'] );
Expand Down

0 comments on commit 6d83e06

Please sign in to comment.