After I updated to WordPress 3.6, my website suddenly showed nasty error messages:
Missing argument 2 for wpdb::prepare()
At first I thought this was a bug introduced with 3.6 (WP forum) but reality showed me that I had been using $wpdb->prepare in the wrong way - so it wasn't a bug, it was my own mistake. More details can be found in this article.
Quick fix:
Some of us used the $wpdb->prepare() without additional parameters, with queries like this;
$wpdb->get_row($wpdb->prepare( "SELECT COUNT(*) FROM table" ));
Obviously the prepare() function is not needed for this query. There is nothing to sanitize. Normally you use prepare() to make sure that parameters that you pass to the query (%d, %s, %f) are cleaned up to avoid malicious crap going down.
The above query should be:
$wpdb->get_row( "SELECT COUNT(*) FROM table" );
For queries that do take parameters I made the mistake to do something like this:
$wpdb->prepare( "SELECT * FROM table WHERE id = ".$id." AND active=1" );
Which in this case means that the function prepare() doesn't sanitize anything and is doing absolutely nothing.
Rewrite such a query for example to:
$wpdb->prepare( "SELECT * FROM table WHERE id = %d AND active=1", $id );
This will fix the nasty error message.