WordPress / WordPress/WordPress-Coding-Standards
Add sniff to detect double quotes in database queries
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.8k
- Forks
- 521
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 1
Description
After receiving a report from a user that has the following MySQL configuration: sql-mode=ANSI_QUOTES, we realised that having double quotes in a query can cause problems.
This is a non-common situation, but as it should be easily detected, we think it will enhance the testing suite.
There are two solutions to resolve this problem:
- Using
wpdb->prepareto inject the data, with%s(without quotes) approach - Using single quotes
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
No file, test, or entry point is named in the issue. Start by locating the existing query-related sniffs and their tests, then define completion as detecting problematic double quotes in database queries and covering the behavior in the test suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100