From 4639b05ff0fb0428ce8e4d357f2437b5f9356bda Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 6 Nov 2025 08:32:56 -0300 Subject: [PATCH] Security/ValidatedSanitizedInput: improve `InputNotValidated` error message The error message for `InputNotValidated` previously listed specific methods (isset() and empty()), but the list was incomplete. Rather than expanding it, this commit adopts a more generic message that won't require updates when new validation methods are added. Fixes 2641 Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com> --- WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php b/WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php index d3b7fe02f8..45ea8ce896 100644 --- a/WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php +++ b/WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php @@ -175,7 +175,7 @@ static function ( $var_name ) { if ( false === $validated ) { $this->phpcsFile->addError( - 'Detected usage of a possibly undefined superglobal array index: %s. Use isset() or empty() to check the index exists before using it', + 'Detected usage of a possibly undefined superglobal array index: %s. Check that the array index exists before using it.', $stackPtr, 'InputNotValidated', $error_data