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

WordPress Trac noreply at wordpress.org
Fri Feb 19 12:28:50 UTC 2021


#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           |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 Wrong return value from get_home_path() in /wp-admin/includes/file.php
 [https://developer.wordpress.org/reference/functions/get_home_path/]

 Expected result: Absolute filesystem path to the root of the WordPress
 installation
 Result in situation below: /

 **Context**
 A WordPress in its own directory installed according method II mentioned
 here
 https://wordpress.org/support/article/giving-wordpress-its-own-directory/

 **Settings** (Example)
 Wordpress: https://pixellogik.de/wp
 Website: https://pixellogik.de

 Plugin WP-SCSS installed

 **Reproduce**
 Open https://pixellogik.de in a browser

 The plugin calls get_home_path()  in enqueue_files() in line 213
 /www/htdocs/w012345/pixellogik.de/wp/wp-content/plugins/wp-scss/class
 /class-wp-scss.php

 Due to the unexpected value "/" of get_home_path() the URL of the
 generated CSS file does not point to a file.
 The CSS won't be loaded, the site looks scrambled.

 **What went wrong?**
 If SCRIPT_FILENAME is outside the installation directory, the directory
 can't be found. This case is not handled, hence value "/" is returned

 **Possible fix:**
 return ABSPATH in that case

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


More information about the wp-trac mailing list