User tests: Successful: Unsuccessful:
No separate issue is linked.
For URL fields allowing relative URLs, detect the current site's hostname followed by a valid boundary rather than comparing the whole input with the hostname. Prepend the protocol for host-plus-path/port/query inputs while retaining normal relative-path handling. Escape the hostname before matching and reject lookalike hostname prefixes.
Run php ./libraries/vendor/bin/phpunit --configuration phpunit.xml.dist --filter UrlFilterTest in a configured Joomla development checkout. The fixture uses host www.example.com and root /joomla. Check hostname-only, path, port, query, uppercase host, lookalike host, relative path, absolute path, and full URL cases. These are reproduction instructions, not a claim of a local test run in this update.
www.example.com/blog/post is treated as a relative path and prefixed with /joomla/.
The result is http://www.example.com/blog/post. A different host such as www.example.com.evil.org/page remains a relative input; ordinary relative and full URLs keep their existing handling.
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
These changes restore preservation of existing URL components rather than introduce a new public API.
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries Unit Tests |
| Title |
|
||||||
@Shubham-Padkonde Did you read the Generative AI policy? You will then need to confirm (by tick) that your contribution is compatible with the policy and GNU/GPL 2 or later.
This pull request has been automatically rebased to 6.2-dev. Joomla! 5.4 is now in security only mode.
| Title |
|
||||||
| Labels |
Added:
Unit/System Tests
bug
PR-6.2-dev
|
||
@Shubham-Padkonde Now after this PR has been rebased to 6.2-dev, unit tests are failing.
Possibly it needs to adjust your new unit tests for the newer phpunit version used in 6.2?
You can find the log here: https://github.com/joomla/joomla-cms/actions/runs/42209505235/job/127865001931?pr=48512 .
Please check.
Thanks in advance.
The rebased branch uses PHPUnit 12, which no longer reads the test’s @dataProvider annotation. I reproduced the zero-argument failure, switched the provider to a static method with #[DataProvider], and corrected the uppercase-host expectation to match Joomla’s existing Punycode normalization. All nine URL cases now run and pass. On native Windows/PHP 8.3.36, the full Unit suite completed with 1,136 passed and 3 skipped (1,794 assertions); changed-file style also passed. A control using the unchanged upstream filter still fails four cases. The production filter is unchanged in this follow-up. Prepared with Codex assistance; personally reviewed before submission.
You were given a template to complete for a reason not for fun. Please complete it