Make WordPress Core

Opened 15 years ago

Closed 12 years ago

Last modified 12 years ago

#10447 closed defect (bug) (fixed)

get_home_path() fails when home url and site url differ in case

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by: dd32's profile dd32
Milestone: 3.5 Priority: normal
Severity: normal Version: 2.9
Component: Filesystem API Keywords:
Focuses: Cc:


If you set your blog's url and site url to the same thing, albeit with differing caps, get_home_path() returns / instead of ABSPATH.

We should probably sanitize/lowercase the two. I've a user who was reporting the weirdest error related to an open_basedir restriction. No wonder it was returning errors...

Change History (15)

#1 @Denis-de-Bernardy
15 years ago

The likelihood is it's also failing if the two differ by a www, but that's just another issue on top of the issues raised in #9873.

#2 @dd32
15 years ago

Sanitizing to lowercase is not going to work in all cases.

Remember most *nix filesystems are case sensitive, and thus, so are the URL's generated for paths.

Without knowing what that function does, given it generates a filesystem path, mearly ignoring the domain name part of the settings could be a middleground. (As thats the only part that can be considered to be case-insensitive on every platform)

#3 @Denis-de-Bernardy
15 years ago

Yup, we're on the same wavelength. I think it something like this, in get_home_path(), might do the trick:

$home = parse_url($home);
$home = $home['path'];
$siteurl = parse_url($siteurl);
$siteurl = $siteurl['path'];

#4 @Denis-de-Bernardy
15 years ago

As to the question on what it does, it's used to by save_mod_rewrite_rules().

#5 @dd32
15 years ago

  • Version set to 2.9

see also: #10609

#6 @ryan
15 years ago

  • Milestone changed from 2.9 to Future Release

#7 @scribu
14 years ago

  • Keywords needs-patch added; 2nd-opinion removed

#8 @hakre
14 years ago

Is it possible taht exemplary data for the two values is provided so that this can be properly tested?

#9 @Denis-de-Bernardy
14 years ago

use: and

#10 @hakre
14 years ago

Might colide with #10970

#11 @dd32
13 years ago

  • Owner dd32 deleted
  • Status changed from new to assigned

just striping myself as owner off this. (Was automatically added based on the component at one stage)

#13 @dd32
12 years ago

  • Milestone changed from Future Release to 3.5

#14 @dd32
12 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from assigned to closed

In [21224]:

Make get_home_path() work in more cases by being case insensitive and sanitzing Windows paths. In some cases (such as differing case of hostnames or paths in the site/home options, or when SCRIPT_FILENAME contains forward slashes) the function was failing to return the correct path, and would instead return /. Props to SergeyBiryukov for the initial patch. Fixes #20449 Fixes #10447

#15 @SergeyBiryukov
12 years ago

  • Keywords needs-patch removed
Note: See TracTickets for help on using tickets.