WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#20849 closed defect (bug)

'ABSPATH' Invalid with Windows Servers — at Initial Version

Reported by: admintiger Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Filesystem API Keywords:
Focuses: Cc:

Description

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

Change History (0)

Note: See TracTickets for help on using tickets.