-
-
Notifications
You must be signed in to change notification settings - Fork 522
Closed
Milestone
Description
Bug Description
When using the sanitize_url it is not recognized as being a proper sanitization method, and recommends esc_url_raw().
Minimal Code Snippet
$postid = ! empty( sanitize_url( $_SERVER['REQUEST_URI'] ) ) ? url_to_postid( sanitize_url( $_SERVER['REQUEST_URI'] ) ) : $context['post']->ID;The issue happens when running this command:
phpcs ...... over a file containing this code:
$postid = ! empty( sanitize_url( $_SERVER['REQUEST_URI'] ) ) ? url_to_postid( sanitize_url( $_SERVER['REQUEST_URI'] ) ) : $context['post']->ID;Error Code
Environment
| Question | Answer |
|---|---|
| PHP version | 8.0.24 |
| PHP_CodeSniffer version | 3.7.1 |
| WPCS version | 2.3.0 |
| WPCS install type | Composer project local |
| IDE (if relevant) | Neovim |
Additional Context (optional)
https://developer.wordpress.org/reference/functions/sanitize_url/#changelog
Tested Against develop branch?
- I have verified the issue still exists in the
developbranch of WPCS.
Metadata
Metadata
Assignees
Labels
No labels