[wp-trac] [WordPress Trac] #35375: function wp_guess_url not compatible with symlinks

WordPress Trac noreply at wordpress.org
Fri Jan 8 19:01:09 UTC 2016


#35375: function wp_guess_url not compatible with symlinks
--------------------------+-----------------------------
 Reporter:  jorgeorpinel  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If your web root is a symlink to another directory in the server, common
 for continuous delivery environments, wp_guess_url will try to find
 {{{#!php
   $script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
 }}}
 inside of
 {{{#!php
   $abspath_fix = str_replace( '\\', '/', ABSPATH );
 }}}
 in line 3837 of wp-includes/functions.php :
 {{{#!php
                         } elseif ( false !== strpos( $abspath_fix,
 $script_filename_dir ) ) {
 }}}

 Since `$_SERVER['SCRIPT_FILENAME']` will resolve a symlink these 2 will be
 completely different and the elseif will be skipped, so `$path =
 $_SERVER['REQUEST_URI'];`

 Is this a problem? Only if you have Wordpress installed as a dependency
 with Composer. See https://github.com/johnpbloch/wordpress -- so maybe I
 shouold report the bug to his repo instead... Not sure!

 Possible fix: I tried wrapping dirname() in readlink() but won't work when
 the path is not a symlink. Maybe a conditional check?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35375>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list