Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
language system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Jun 2011 at 00:54 UTC
Updated:
29 Jul 2014 at 19:37 UTC
Steps:
1)Configure server to use nonstandard port for HTTP (e.g., http://example.com:11990/)
2)Set domain based language selection (e.g., http://de.example.com - with or without the port this fails)
3)Request page http://de.example.com:11990/path/to/page
Expected: would serve the translated version of the page
Actual: serves default language page
Traced this back to locale_language_from_url()
case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN:
foreach ($languages as $language) {
$host = parse_url($language->domain, PHP_URL_HOST);
if ($host && ($_SERVER['HTTP_HOST'] == $host)) {
$language_url = $language->language;
break;
}
}
after parse_url() $host will be set to "de.example.com" while $_SERVER['HTTP_HOST'] will have the port number de.example.com:11990. I fixed this by wrapping $_SERVER['HTTP_HOST'] in a call to parse_url.
| Comment | File | Size | Author |
|---|---|---|---|
| locale.inc_.nonstandard-port.patch | 540 bytes | pfahlr |
Comments
Comment #1
plachBugs are fixed in the dev version first.
We need tests to avoid breaking this again.
Comment #3
gábor hojtsySounds like the Drupal 6 bug from #755352: Language negotiation fails on custom server port.
Comment #4
gábor hojtsy#678924: Domain language negotiation doesn't take port number into account - function language_initialize() also has a suggestion for Drupal 6.
Comment #5
attiks commentedDuplicate of #1250800: Language domain should work regardless of ports or protocols