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.

CommentFileSizeAuthor
locale.inc_.nonstandard-port.patch540 bytespfahlr

Comments

plach’s picture

Version: 7.0 » 8.x-dev
Status: Active » Needs review
Issue tags: +Needs backport to D7

Bugs are fixed in the dev version first.

We need tests to avoid breaking this again.

Status: Needs review » Needs work

The last submitted patch, locale.inc_.nonstandard-port.patch, failed testing.

gábor hojtsy’s picture

gábor hojtsy’s picture

attiks’s picture

Status: Needs work » Closed (duplicate)