WordPress / WordPress/WordPress-Coding-Standards

Prepared SQL sniff: support array_map()

Open
#1,046 2 comments 1 reaction 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.