[wp-trac] [WordPress Trac] #27420: get_stylesheet_directory(); function....windows backslash

WordPress Trac noreply at wordpress.org
Sat Mar 15 08:20:46 UTC 2014


#27420: get_stylesheet_directory(); function....windows  backslash
-------------------------+------------------------------
 Reporter:  kosher_12    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Themes       |     Version:  3.8.1
 Severity:  normal       |  Resolution:
 Keywords:  close        |     Focuses:
-------------------------+------------------------------

Comment (by kosher_12):

 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?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27420#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list