[wp-trac] [WordPress Trac] #12080: plugins_url() does not correctly detect mu-plugins on Windows

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 29 18:06:37 UTC 2010


#12080: plugins_url() does not correctly detect mu-plugins on Windows
--------------------------+-------------------------------------------------
 Reporter:  TheDeadMedic  |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  low           |   Milestone:  Unassigned
Component:  Multisite     |     Version:  2.9.1     
 Severity:  minor         |    Keywords:            
--------------------------+-------------------------------------------------
 {{{
 if ( $plugin !== '' && preg_match('#^' . preg_quote(WPMU_PLUGIN_DIR .
 DIRECTORY_SEPARATOR, '#') . '#', $plugin) ) {
     $url = WPMU_PLUGIN_URL;
 } else {
     $url = WP_PLUGIN_URL;
 }
 }}}

 Even if {{{$plugin}}} is in mu-plugins, the {{{preg_match}}} will fail on
 Windows systems if {{{__FILE__}}} is passed as {{{$plugin}}}, since
 {{{WPMU_PLUGIN_DIR}}} contains forward slashes (whereas {{{__FILE__}}} on
 Windows are all backslashes).

 Proposed fix is to apply path formatting to {{{WPMU_PLUGIN_DIR}}} and
 {{{$plugin}}} found in {{{plugin_basename()}}}.

 {{{
 $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for
 Win32 installs
 $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any
 duplicate slash
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12080>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list