[wp-trac] [WordPress Trac] #16762: wpdb::$base_prefix is not documented
WordPress Trac
noreply at wordpress.org
Tue Feb 25 00:21:24 UTC 2014
#16762: wpdb::$base_prefix is not documented
------------------------------+------------------
Reporter: hakre | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.9
Component: Database | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses:
------------------------------+------------------
Comment (by DavidAnderson):
Responding to the original report: using wpdb::get_blog_prefix(0) as an
alternative to $wpdb->base_prefix is wrong, for the reason given in the
original report: "It might be that this function call does not cover all
cases needed because if MULTISITE is not defined when called, it will not
return the wpdb::$base_prefix."
The "might" can happen, on sites that have been upgraded from old pre-3.0
WPMU setups. In that situation, wpdb::get_blog_prefix(0) returns junk
data, because MULTISITE is indeed not set and is_multisite() is still
true. I have seen this happen in the wild. Despite the apparent intention
inside the code of wpdb::get_blog_prefix(), in fact
wpdb::get_blog_prefix(0) is not useful unless you first know that you're
not on such a site, and if you are, only wpdb::$base_prefix is useful.
Therefore, the simpler patch that Pento has added in 16762.diff should be
used, and the original patch should not. It is better to just make clear
that wpdb::$base_prefix is the way to go, by making it explicitly public.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/16762#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list