[wp-trac] [WordPress Trac] #20849: 'ABSPATH' Invalid with Windows Servers

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 5 23:56:16 UTC 2012


#20849: 'ABSPATH' Invalid with Windows Servers
--------------------------+-----------------------------
 Reporter:  admintiger    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Filesystem    |    Version:  3.4
 Severity:  major         |   Keywords:
--------------------------+-----------------------------
 The following code defines 'ABSPATH' with mixed backward and forward
 slashes (like this: 'C:\public\www.example.com/') six places within
 WordPress when run on a Windows server:

 define('ABSPATH', dirname(__FILE__) . '/');

 (Note: the text editor mangled the "magical" PHP FILE constant)

 Additional path strings with forward slashes are subsequently concatenated
 many places in the core, in plugins, and sometimes in themes, resulting in
 many invalid filepaths similar to the following example:

 C:\public\www.example.com/wp-includes/shortcodes.php

 Mixed slashes like that cause a variety of malfunctions generally when
 WordPress is used on Windows servers, but especially when minifying and/or
 caching plugins are used.

 I suggest changing:

 define('ABSPATH', dirname(__FILE__) . '/');

 to:

 define('ABSPATH', str_replace(chr(92), '/', dirname(__FILE__)) . '/');

 in each of the following places to correct those problems:

 \wp-config-sample.php -> Line 87

 \wp-load.php -> Line 22

 \wp-admin\load-scripts.php -> Line 11

 \wp-admin\load-styles.php -> Line 11

 \wp-admin\setup-config.php -> Line 39

 \wp-admin\gears-manifest.php -> Line 17

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


More information about the wp-trac mailing list