-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow prepared queries to be passed in via a variable #1331
Comments
Duplicate of #469? |
I would like to see this rectified as well. The code being written is valid and conforms to the standard. This is a false detection and it would be preferable to fix this in the rules instead of peppering source code with exceptions for PHPCS. |
Looks like this is a problem for Core, too: I'm finding a lot of instances of this (perfectly valid) pattern. |
Just thinking out loud here, in case code like above is found, the sniff should look what are the previous tokens (up to some point which can be right above the found issue, or even passed from another file in which case it's impossible to determine if the query is prepared or not) in the file, and if one of them matches Is this even possible (sounds highly unlikely)? Wouldn't it be easier to just refactor the offending code to include prepared statement? @pento what is the number of such occurrences in the core? |
There are currently 116 It's possible to refactor the simple examples to be |
Same problem here. A prepared statement should not be required on |
Hi |
Given the following code, a
WordPress.WP.PreparedSQL.NotPrepared
error is raised:The error is raised because the prepared query is passed in via a variable instead of
prepare()
being called directly insideget_col()
.Is there a way that this format can be supported in WPCS?
The text was updated successfully, but these errors were encountered: