summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--includes/locale.inc8
-rw-r--r--modules/locale/locale.test2
3 files changed, 9 insertions, 2 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 4d2ca4595..077d15c87 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -16,6 +16,7 @@ Drupal 7.15, xxxx-xx-xx (development version)
may access the language using entity_language() (API change).
- Fixed regression: The first plural index on a page was not calculated
correctly.
+- Fixed bug: Language detection by domain only worked on port 80.
Drupal 7.14 2012-05-02
----------------------
diff --git a/includes/locale.inc b/includes/locale.inc
index 7fb8d6424..fde19dd55 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -279,6 +279,12 @@ function locale_language_from_url($languages) {
break;
case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN:
+ // Get only the host, not the port.
+ $http_host= $_SERVER['HTTP_HOST'];
+ if (strpos($http_host, ':') !== FALSE) {
+ $http_host_tmp = explode(':', $http_host);
+ $http_host = current($http_host_tmp);
+ }
foreach ($languages as $language) {
// Skip check if the language doesn't have a domain.
if ($language->domain) {
@@ -286,7 +292,7 @@ function locale_language_from_url($languages) {
// Remove protocol and add http:// so parse_url works
$host = 'http://' . str_replace(array('http://', 'https://'), '', $language->domain);
$host = parse_url($host, PHP_URL_HOST);
- if ($_SERVER['HTTP_HOST'] == $host) {
+ if ($http_host == $host) {
$language_url = $language->language;
break;
}
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 0c6da13df..97bdafc32 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -2378,7 +2378,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
array(
'language_negotiation' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'locale_language_negotiation_url_part' => LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN,
- 'locale_test_domain' => $language_domain,
+ 'locale_test_domain' => $language_domain . ':88',
'path' => 'admin/config',
'expect' => $language_string,
'expected_provider' => LOCALE_LANGUAGE_NEGOTIATION_URL,