Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#27420 closed enhancement (duplicate)

get_stylesheet_directory(); function....windows backslash

Reported by: kosher_12 Owned by:
Priority: normal Milestone:
Component: Themes Version: 3.8.1
Severity: normal Keywords:
Cc: Focuses:

Description

Hi There,

as the title says, is it possible to improve most of the wordpress path function in windows.

e.g.

$s = get_stylesheet_directory();
print_r($r);

output
F:\xampp\htdocs\wp\wp-content/themes/cmk

its not a big deal as most of wordpress developers,creates another function to output it properly, but I am thinking wordpress should fixed it from its core.

Cheers,
Kenn

Change History (3)

#1 @SergeyBiryukov
13 years ago

  • Component General → Themes
  • Keywords close added
  • Type feature request → enhancement

Sounds like a duplicate of #20849.

F:\xampp\htdocs\wp\wp-content/themes/cmk is a valid path on Windows, there's nothing wrong with it.

#2 @kosher_12
13 years ago

Thanks for the response,

Sorry for putting this on the wrong section. Never read anything before posting

Well, I never mentioned its invalid, indeed backslash isn't actually a problem until using it on validation statement like this then problem will occur.

if(strpos(MyPath(__FILE__), get_stylesheet_directory()) !== false){
	//Fly to the Sky
}

the problem is that, it will always return false, because of backlash

$f = MyPath(__FILE__);
$s = get_stylesheet_directory();
print_r($f.'<br/>'.$s);

output
F:/xampp/htdocs/wp/wp-content/themes/test/config/admin-config.php
F:\xampp\htdocs\wp/wp-content/themes/test

Yes, I can just simply do something like this MyPath(get_stylesheet_directory())

and viola, it works.

But my question is.

Why can't wordpress fix backslashes on its return value in all the path functions, I don't think its hard to fix.

or is there actually a reason why it should have backslashes?

#3 @chriscct7
11 years ago

  • Keywords close removed
  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Duplicate of #20849.

Note: See TracTickets for help on using tickets.