WordPress / WordPress/WordPress-Coding-Standards
Prepared SQL sniff: support array_map()
Open
Nobody has claimed this yet.
Focus: DB
Focus: Security
Type: Enhancement
- Dominant language
- PHP
- Stars
- 2.8k
- Forks
- 521
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 1
Description
Hi,
intval is accepted as an SQL escaping function but it is most often used together with array_map.
In WPCS 0.12.0, the query at https://github.com/WordPress/WordPress/blob/4.8/wp-includes/taxonomy.php#L3330 gives the error:
Use placeholders and $wpdb->prepare(); found array_map
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
Start by reproducing the WPCS 0.12.0 warning against WordPress's taxonomy.php query at line 3330. Trace the prepared SQL sniff's handling of intval and array_map, then verify that this valid pattern no longer reports array_map as an escaping error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100