Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/joomla#26 - Fix path derivation when CMS is rooted in a subdir #16890

Merged
merged 4 commits into from
Mar 24, 2020

Conversation

totten
Copy link
Member

@totten totten commented Mar 24, 2020

Backport #16887 from 5.24 RC to 5.23 stable. Add release notes.

totten added 4 commits March 24, 2020 15:12
Overview
--------

CiviCRM is deployed inside a CMS. The CMS is usually deployed at the HTTP root (`http://example.org`),
but it is sometimes deployed in a subdirectory (`http://example.org/my-cms`).

Some asset URLs are computed using the variables `[civicrm.bower]`, `[civicrm.packages]`, and `[civicrm.vendor]`, which
are derived from the value of `[civicrm.root]`.  However, if the site is deployed in a subdirectory, and if using v5.23,
then the computation of `[civicrm.bower]` (etc) can misbehave.

Before
------

When the URL for `[civicrm.bower]` (or similar) is derived, it goes through multiple filters - first, from absolute to
relative, and then later from relative back to absolute.  In the process, the base is inadvertently changed.

After
-----

When the URL is derived, it is computed in absolute format - and simply kept that way.

Comments
--------

Regarding test coverage, there are two relevant unit-tests. This PR only updates one.

* `E2E\Core\PathUrlTest`: This is a more concrete smoke test which demonstrates functional problems with variables like
  `[civicrm.bower]`.  It should already catch problems like dev/joomla#26...  but only if you run the E2E suite on a system
  where the CMS was deployed to a subdirectory.  `civibuild` doesn't currently include such a build-type.
* `Civi\Core\PathsTest`: This is a more abstract, headless test to examine edge-cases in `Civi\Core\Paths`. It does not
  specifically check for `[civicrm.bower]` or similar variables (b/c the URL routing is ill-defined in a headless context).
  However, I've updated it to compare/contrast the working and non-working ways to derive variables.
@civibot
Copy link

civibot bot commented Mar 24, 2020

(Standard links)

@civibot civibot bot added the 5.23 label Mar 24, 2020
@seamuslee001 seamuslee001 merged commit 89d5640 into civicrm:5.23 Mar 24, 2020
@totten totten deleted the 5.23-dbl-path branch March 24, 2020 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants