[security] Fixed a issue where hundreds of Warning "first argument of wpdb::prepare should have a placeholder" are displayed while define('WP_DEBUG', true); #32
Conversation
…WP_DEBUG', true); is present; more details: "first argument of wpdb::prepare should have a placeholder".
A checked was performed to find all files containing $wpdb->prepare, using
- grep -ri 'wpdb->prepare' *
And the result showed:
- plugins/wordpress-https/lib/WordPressHTTPS.php:
- $multisite_hosts = $wpdb->get_col($wpdb->prepare("SELECT domain FROM " . $wpdb->blogs, NULL));
- plugins/wordpress-https/lib/WordPressHTTPS.php:
- $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM " . $wpdb->blogs, NULL));
- plugins/wordpress-https/uninstall.php:
- $blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM " . $wpdb->blogs, NULL));
Replaced 3 instances of where $wpdb->prepare() second argument was passed as null and possibly opens up a vulnerability.
Summary of the change:
- Orignial: $wpdb->get_col($wpdb->prepare("SELECT domain FROM " . $wpdb->blogs, NULL));
- New: $wpdb->get_col($wpdb->prepare("SELECT domain FROM %d", $wpdb->blogs));
For information see the ticket that introduced the notice in WP3.9 https://core.trac.wordpress.org/ticket/25604
headstash
added a commit
that referenced
this pull request
Oct 1, 2014
[security] Fixed a issue where hundreds of Warning "first argument of wpdb::prepare should have a placeholder" are displayed while define('WP_DEBUG', true);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, I was recently using your plugin whilst debugging a multi-site configuration and noticed several small errors and possible vulnerabilities in your plugin. Please see my change log for more information, fix is simple and only 3 lines.
I was doing a little debugging with WordPress 3.9 using your plugin and notice that when your plugin is enabled and wp_debug is set to true. Certain pages on the admin side can generate hundreds possibly thousands of warning for "first argument of wpdb::prepare should have a placeholder".
Summary of the change:
For information see the ticket that introduced the notice in WP3.9 https://core.trac.wordpress.org/ticket/25604
My configuration:
Anyway I hope that helps!
Thanks and kind regards,
Steven