Commit e303b674 authored by catch's avatar catch

Issue #1572394 by attiks, Sweetchuck: Fixed Language detection by domain only works on port 80.

parent faa63d22
......@@ -220,6 +220,11 @@ function language_from_url($languages) {
break;
case LANGUAGE_NEGOTIATION_URL_DOMAIN:
// Get only the host, not the port.
$http_host= $_SERVER['HTTP_HOST'];
if (strpos($http_host, ':') !== FALSE) {
$http_host = current(explode(':', $http_host));
}
$domains = language_negotiation_url_domains();
foreach ($languages as $language) {
// Skip the check if the language doesn't have a domain.
......@@ -228,7 +233,7 @@ function language_from_url($languages) {
// the hostname.
$host = 'http://' . str_replace(array('http://', 'https://'), '', $domains[$language->langcode]);
$host = parse_url($host, PHP_URL_HOST);
if ($_SERVER['HTTP_HOST'] == $host) {
if ($http_host == $host) {
$language_url = $language->langcode;
break;
}
......
......@@ -706,7 +706,7 @@ class LanguageUILanguageNegotiationTestCase extends WebTestBase {
array(
'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'language_negotiation_url_part' => LANGUAGE_NEGOTIATION_URL_DOMAIN,
'language_test_domain' => $language_domain,
'language_test_domain' => $language_domain . ':88',
'path' => 'admin/config',
'expect' => $language_string,
'expected_method_id' => LANGUAGE_NEGOTIATION_URL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment