Disqus Missing argument 2 for wpdb::prepare()
-
Hiya folks,
Got the following message in php error logs:
Missing argument 2 for wpdb::prepare(), called in ../wp-content/plugins/disqus-comment-system/disqus.php on line 285
The above error is generating high mysql resource and has caused a site to go offline a couple times.
The fix is pretty simple, just replace curly bracket with %.
The following is what we have done to fix the issue:
https://github.com/theWPValet/disqus-wordpress/commit/9a57e56b70472cbde4275fc1e940648c968ad636// and follow up using legacy Disqus agent if (!$commentdata) { - $commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = 'Disqus/1.0:{$comment->id}' LIMIT 1"), ARRAY_A); + $commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = 'Disqus/1.0:%s' LIMIT 1", $comment->id), ARRAY_A); }
We’d love to see it incorporated into the plugin to prevent the need for maintaining a separate version. Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Disqus Missing argument 2 for wpdb::prepare()’ is closed to new replies.