[wp-trac] [WordPress Trac] #19566: Multisite: No Database Prefix causes strpos(): Empty delimiter

WordPress Trac wp-trac at lists.automattic.com
Tue Dec 20 22:55:30 UTC 2011


#19566: Multisite: No Database Prefix causes strpos(): Empty delimiter
--------------------------+------------------------
 Reporter:  Ipstenu       |       Owner:  nacin
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  3.3.1
Component:  Multisite     |     Version:  3.3
 Severity:  minor         |  Resolution:
 Keywords:                |
--------------------------+------------------------

Comment (by nacin):

 By full support, I just mean it not breaking, but no DB prefix in
 multisite is a huge problem.

 We store site-specific usermeta keyed by DB prefix. For example,
 'wp_capabilities'.

 The same carries over to multisite. For example, 'wp_4_capabilities', if
 the prefix is 'wp_' and the blog ID is 4.

 In a network, the initial blog does not have a blog ID. That makes it
 'capabilities' instead of '1_capabilities'.

 We have a user option API that checks for a site-specific usermeta key
 first, then falls back to a global key. That means if 4_capabilities is
 not found, then capabilities is not used.

 Now, 'capabilities' is a straw man here, as we strictly use user_meta
 rather than user_option for capabilities. But we do use user_option
 elsewhere, and we do *not* want it to fall back to the root site. While it
 may not have serious effects for a particular key in core (I haven't
 checked), it could potentially do damage to a lot of plugins.

 As we can't die() on existing sites, we should block empty prefixes on
 single-site install, as well as on network.php to create a network. (We
 already block it for setup-config.php.) And I would go so far as to issue
 a visual warning for networks that have empty prefixes that they are doing
 it wrong, a _doing_it_wrong() message to make it into the logs (again only
 multisite), and a code comment in wp-config-sample.php.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19566#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list