-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
WordPress.DB.PreparedSQL.InterpolatedNotPrepared flagging $this->table_name but not $wpdb->table_name #2401
Comments
Your information is outdated. You can use the I suggest closing this ticket. |
Ok, thanks. I guess I will write for "only" 67% of the WP Users then. Not really a big issue in this particular project. However this remains a problem if one wants to support older versions. |
Just out of curiosity, why would you want to support older versions? Besides doing major version updates which can be scary and include some BC breaks, the majority of time the updates in the minor versions are seamless and only affect things like the core editor (which is magically allowed to do BC breaks on minor updates 🙃). |
Because there are 33% of all WordPress websites (currently) not on 6.2 Me personally I try to keep the things up to date, unfortunately that is not always the case/possible/the real world. |
Hi @smileBeda, I'm the one who added |
Sorry the delay here - happy to talk @craigfrancis |
There is no way we should use a placeholder for a tablename.
Yet WPDB flags this approach as false and suggests using placeholders (which is potentially not only wrong but even more unsafe).
$existing = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$this->table_name} WHERE bla = %s", $bla ) );
=> Fails sniff.This way forces to rewrite the database table name hardcoded potentially countless times instead of setting it to the object.
I can't believe this is how we have to do it.
It seems to have
$wpdb
whitelisted, however you still would have to hardcode thetable_name
every time you do aget_var
orget_row
query.The text was updated successfully, but these errors were encountered: