WordPress 3.5 Issue Resolved (Missing argument 2 for wpdp::prepare())
-
We’re running Download Monitor on https://logikatech.com with great success. A recent WordPress upgrade caused an error message after the registration page:
Warning: Missing argument 2 for wpdb::prepare(), called in .../wp-content/plugins/download-monitor/download.php on line 208 and defined in .../wp-includes/wp-db.php on line 992
[Note:URLs redacted for security]
Based on this excellent post about the wpdp::prepare() issue, the problem is a missing second parameter to the call.
I updated line 208 in /download-monitor/download.php from:
$old_date = $wpdb->get_var( $wpdb->prepare( "SELECT date FROM $wp_dlm_db_log WHERE ip_address = '$ipAddress' AND download_id = ".$d->id." ORDER BY date DESC limit 1;") );
to:
$old_date = $wpdb->get_var( $wpdb->prepare( "SELECT date FROM $wp_dlm_db_log WHERE ip_address = '$ipAddress' AND download_id = %s ORDER BY date DESC limit 1;", $d->id) );
Changing the string from being inserted in the middle of the query to a passed parameter solves the issue and doesn’t seem to introduce any new ones.
- The topic ‘WordPress 3.5 Issue Resolved (Missing argument 2 for wpdp::prepare())’ is closed to new replies.