Bug #145
Headspace's realpath() function incorrectly handles ~user/ directories
| Status : | Closed | Start : | 04/01/2008 | |
| Priority : | Normal | Due date : | ||
| Assigned to : | John Godley | % Done : | 100% |
|
| Category : | - | |||
| Target version : | 3.4.1 | |||
Description
When Wordpress is installed into a directory with a '~' somewhere in its path, headspace does not function correctly. All images and scripts show up as missing (see screenshot of the "modules" page). It is attempting to locate images at an address of http://domain/blog/home/host_account/public_html/~user/blog/wp-content/plugins/headspace2/images/help.png.
The correct address would be: http://domain/blog/wp-content/plugins/headspace2/images/help.png
while the path to this image would be: /home/host_account/public_html/~user/blog/wp-content/plugins/headspace2/images/help.png.
This issue occurs because the provided realpath() function (plugin.php, line 400-ish) replaces all ~ characters in $path with $_SERVER['DOCUMENT_ROOT']. This behavior is incorrect, as it should only do this when the ~ occurs at the beginning of the string. (Calling the system's realpath() instead of this->realpath() in url() at about line 339 causes headspace to behave correctly as long as the system has realpath())
History
04/02/2008 03:16 PM - John Godley
- Status changed from New to Closed
- Target version set to 3.4.1
- % Done changed from 0 to 100
A path with ~ in it seems to be asking for trouble!
04/03/2008 09:14 PM - Anonymous
My hosting environment might be a little unusual (ie the ~user folder maps to http://user.domain/), but headspace2 is the only plugin (or anything really) that has had any trouble with this. It doesn't really seem that it would be too hard to just replace a ~ if it only occurs at the beginning of the path (I don't really know PHP so well, so I might be wrong).
In any case, having a ~ in the path is unavoidable in some situations, but if you've determined that paths containing ~ are asking for trouble and therefore unworthy of consideration, who am I to disagree?