PHPCS Error: Wrong escaping function. HTML attributes should be escaped by esc_attr(), not by esc_html_e()
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 53
- Forks
- 38
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
When running a PHPCS scan, the following error is present:
Wrong escaping function. HTML attributes should be escaped by esc_attr(), not by esc_html_e() (WordPressVIPMinimum.Security.ProperEscapingFunction.htmlAttrNotByEscHTML).
For this line: https://github.com/Yoast/duplicate-post/blob/trunk/src/admin/views/options.php#L247
esc_attr_e should be used instead of esc_html_e
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
Open src/admin/views/options.php around line 247 and review the PHPCS warning for the attribute escaping call. Replace the incorrect escaping usage with the function named in the issue, then run PHPCS to confirm the warning is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100