[wp-trac] [WordPress Trac] #52575: get_home_path() returns "/" instead of path to WordPress directory

WordPress Trac noreply at wordpress.org
Sun Jul 2 15:12:43 UTC 2023


#52575: get_home_path() returns "/" instead of path to WordPress directory
--------------------------------------------+------------------------------
 Reporter:  pixellogik                      |       Owner:  (none)
     Type:  defect (bug)                    |      Status:  new
 Priority:  normal                          |   Milestone:  Awaiting Review
Component:  Filesystem API                  |     Version:  5.6.1
 Severity:  major                           |  Resolution:
 Keywords:  reporter-feedback dev-feedback  |     Focuses:
--------------------------------------------+------------------------------
Changes (by arnolp):

 * keywords:  reporter-feedback dev-feedback close => reporter-feedback dev-
     feedback


Comment:

 On my quite standard installation (wp in subdirectory,nginx) : this bug
 occurs on **every** page.


 {{{
 $home : https://<mysite.com>
 $siteurl : https://<mysite.com>/wp
 $wp_path_rel_to_home : /wp
 $_SERVER['SCRIPT_FILENAME'] : /www/<myusername>/public/index.php
 }}}

 :
 so on line 113,

 {{{
  $pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ),
 trailingslashit( $wp_path_rel_to_home ) );
 }}}
 will always return 0, relative path is NOT in server script filename

 --> home_path will always return "/"

 --> generating tons of open_basedir restriction in effect, as **wordpress
 tries to read the root of the server** on includes/misc.php on lines
 278/279 !

 I had to manually patch wp core to fix it , which will break on every
 update ..

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


More information about the wp-trac mailing list