joomla-cms
joomla-cms copied to clipboard
fix joomla/joomla-cms#36669
Pull Request for Issue #36669 .
Summary of Changes
Remove JPATH_ROOT from absolute file path only if JPATH_ROOT is at beginning of string
Testing Instructions
Every asset loaded with HTMLHelper::_ is affected
Actual result BEFORE applying this Pull Request
If JPATH_ROOT is repeated inside file names, resources are not getting loaded.
Example:
JPATH_ROOT = '/joomla'
$path = '/joomla/media/system/images/joomla-favicon.svg'
Wrong output before: /media/system/images-favicon.svg
Another less unusual example:
JPATH_ROOT = '/app/html
$path = '/app/html/media/com_something/js/app/html_custom.js'
Wrong output before: /media/com_something/js_custom.js
Expected result AFTER applying this Pull Request
If JPATH_ROOT is present 2 times in the $path, it will be removed only if at beginning (where it should be)
Example:
JPATH_ROOT = '/joomla'
$path = '/joomla/media/system/images/joomla-favicon.svg'
Correct output with patch: /media/system/images/joomla-favicon.svg
Another less unusual example:
JPATH_ROOT = '/app/html
$path = '/app/html/media/com_something/js/app/html_custom.js'
Wrong output before: /media/com_something/js/app/html_custom.js
Documentation Changes Required
Problem was not declared anywhere else
Code run as before (JPATH_ROOT is not supposed to be in the middle of the $path if not for casuality)
This pull request has automatically rebased to 4.2-dev.
This pull requests has been automatically converted to the PSR-12 coding standard.
This pull request has been automatically rebased to 4.3-dev.
This pull request has been automatically rebased to 4.4-dev.