Skip to content

DB/PreparedSQL: fix false positives with case-insensitive function names#2570

Merged
dingo-d merged 1 commit into
WordPress:developfrom
rodrigoprimo:prepared-sql-fix-false-positive
Aug 8, 2025
Merged

DB/PreparedSQL: fix false positives with case-insensitive function names#2570
dingo-d merged 1 commit into
WordPress:developfrom
rodrigoprimo:prepared-sql-fix-false-positive

Conversation

@rodrigoprimo

Copy link
Copy Markdown
Contributor

The sniff was incorrectly flagging valid SQL escaping functions when they were written with mixed or uppercase letters (e.g., 'Esc_Sql' instead of 'esc_sql'). This occurred because the function name comparison was case-sensitive when checking against the predefined list of safe SQL escaping functions.

This fix ensures that function names are properly normalized to lowercase before comparing them against the allowed escaping functions list, preventing false positives regardless of the function name's capitalization.

The sniff was incorrectly flagging valid SQL escaping functions when they were
written with mixed or uppercase letters (e.g., 'Esc_Sql' instead of 'esc_sql').
This occurred because the function name comparison was case-sensitive when
checking against the predefined list of safe SQL escaping functions.

This fix ensures that function names are properly normalized to lowercase
before comparing them against the allowed escaping functions list, preventing
false positives regardless of the function name's capitalization.

@jrfnl jrfnl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

@dingo-d dingo-d merged commit ede46ef into WordPress:develop Aug 8, 2025
41 checks passed
@rodrigoprimo rodrigoprimo deleted the prepared-sql-fix-false-positive branch August 8, 2025 11:46
@jrfnl jrfnl modified the milestones: 3.2.x, 3.3.0 Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants