Repository navigation
Conversation
detectRequestUri() built the request URI from the scheme and the Host header only. Without that header (HTTP/1.0 requests, a web application booted from the command line) the URI became "http:///path", which does not parse, or the first path segment was taken as the host, so uri.base and uri.root were wrong. The host now falls back to SERVER_NAME (with SERVER_PORT unless it is the default port of the scheme) and then to the host of the site_uri option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
detectRequestUri()builds the request URI as scheme +HTTP_HOST+ path. Without aHostheader (an HTTP/1.0 request, or a web application booted from the command line) the result ishttp:///j/index.php, which does not parse, or — when the script name has no leading slash — the first path segment is taken as the host, souri.base.*anduri.rootare wrong (see joomla/joomla-cms#38524).The host now falls back to
SERVER_NAME(withSERVER_PORTappended unless it is the default port of the scheme) and then to the host and port of the existingsite_urioption. If none of them is available the behaviour is unchanged.This is an alternative to #120, which throws from
detectRequestUri()instead; that turns a degraded state into a fatal error during construction and breaks most tests.Testing Instructions
vendor/bin/phpunit --filter testDetectRequestUriWithoutHostcoversSERVER_NAMEwithout a port, with a non-default port, with port 80, HTTPS with port 443, and thesite_urifallback. Without the change insrc/the first four error and the last returnshttp:///j/index.php. The existingtestDetectRequestUricases (with aHostheader) are unchanged.Documentation Changes Required
docs/configuration.md(uri.request) anddocs/api-reference.md(detectRequestUri()) describe the fallback.Alternative to #120
🤖 Generated with Claude Code