Installer: Bad site.url config variable on Windows
@danpros
For testing I installed HTMLy 2.8.2 on a portable Apache 2.4.x + PHP 5.4.x webserver on Windows (XP).
I noticed the installer assigns, e.g., http://localhost/\/ to site.url.
This results at least in a strange browser URL like http://localhost///admin/config for the admin panel.
The problem comes from function generateSiteUrl(), where dirname() is used incorrectly, because on Windows the directory separator is \, not /. Fortunately PHP has the directory constant DIRECTORY_SEPARATOR.
I will submit a PR for fixing. This PR will also rearrange the dir code in generateSiteUrl() to make it more readable.
Um, it's a little more complicated than I first thought.
Version 2.8.2 code works fine, when the installer is started from a sub-folder, e.g., "htdocs/blog/install.php".
But when in document root, i.e., "htdocs/install.php" it reports "dir" being "\\" (two backslashes, one is probably for escaping) on error_log(print_r($dir, true));.
Hello,
Please make PR if you find solutions for it.
Thanks,