JPATH_BASE calculated incorrectly in a system running under a virtual directory under Windows and Joomla
Overview
Please describe your problem or bug in detail.
Reproduction steps
CiviCRM is set up under Joomla using a virtual directory under an IIS based web site, e.g. https://example.com/subdir/
Current behaviour
Running say the cron job (cron.php) yields this error. :\Web root\libraries/vendor/autoload.php. CiviCRM does not record cron to have run.
Expected behaviour
What should happen.
This should be opened. :\Web root\subdir\libraries\vendor\autoload.php" CiviCRM should record cron to have run.
Environment information
- Browser: _Edge
- CiviCRM: _Release 5.19.1 (but seen in many earlier versions).
- PHP: 7.2.24..._
- CMS: Joomla 3.9.6/...
- Database: MySQL 5.7.28...
- Web Server: IIS under Windows 10...
Comments
_Replacing line 569 in /administrator/components/com_civicrm/civicrm/CRM/Utils/System/Joomla.php with define('JPATH_BASE', $joomlaBase . DS. 'administrator'); // to make sure we analyse correctly in the Windows environment seems to solve the problem. I plan to create a PR, but this just flags the issue as a placeholder. Maybe someone else is working on the same file, and in which case can pick it up.
The issue occurs because line 12 of /administrator/includes/defines.php uses the directory separator to explode JPATH_BASE into its component parts. If, therefore, the separator between subdirectory and administrator directories is not the directory separator, JPATH_BASE won't be analysed correctly.