WordPress / WordPress/WordPress-Coding-Standards
Downgrade unslash error to warning
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.8k
- Forks
- 521
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 1
Description
I believe the unslash error should be downgraded to a warning.
Quite often the expected value is known to the programmer and is a value which will never be slashed in the first place. Think: ?nr=5&type=post. If the value is slashed where no slashes are expected, it will automatically be an invalid value.
I know we can whitelist, but that litters the code with WPCS related comments, while IMHO, whitelist comments should only be used for exceptions.
For that matter, AFAIK, a nonce will never be a value which will be slashed, so unslashing shouldn't be required. If there are slashes in the received nonce, it will automatically be an invalid nonce value.
Opinions ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by locating the PHP_CodeSniffer sniff in WordPress Coding Standards that reports unslash errors. Review how the existing whitelist behavior handles query values and nonces, then define and verify the change so these cases produce warnings rather than errors without requiring whitelist comments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100