WordPress / plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
https://wordpress.org/plugins/plugin-check/
GNU General Public License v2.0
195 stars 39 forks source link

MariaDB generating error when we are using %s as placeholder for table name when CS(code sniffer) suggest to used %s instead %i #439

Closed crathod-io closed 3 months ago

crathod-io commented 3 months ago

ERROR WordPress.DB.PreparedSQLPlaceholders.UnsupportedIdentifierPlaceholder

The %i modifier is only supported in WP 6.2 or higher. Found: "%i".

crathod-io commented 3 months ago

Screenshot from 2024-03-20 18-29-09

swissspidy commented 3 months ago

Here we go again :-)

Which plugin is this for?

If this happens in your own plugin, the error message is pretty self-explanatory. The "%i" modifier is only supported on WP 6.2+, so if you support older versions you need to fall back to something else.

swissspidy commented 3 months ago

Also, it would really help if you could provide more context instead of just copy-pasting the error message. What is it you want to achieve, i.e. is this a bug in your own plugin that you want to address, or do you believe there is an issue in Plugin Check that needs to be resolved? Without more information this ticket is not really actionable.

swissspidy commented 3 months ago

Closing this as not applicable because this check is working as expected.

The error tells you a potential issue with your code that you should address.

If your plugin is supposed to work for WordPress versions older than 6.2, you cannot use the "%i" placeholder in queries, as older versions don't support it.