Reputation: 4228
I am calling a function that reads $_SERVER['HTTP_HOST']
and render an anchor element with href that is read from $_SERVER['HTTP_HOST']
.
On my mobile theme on Android devices this function appends a dot at the end of the url, so it looks like www.example.com. which makes some other functions work improperly.
Upon debugging I realized that it is precisely $_SERVER['HTTP_HOST']
that has this wrong value.
Anyone has this problem or any idea how to fix it?
Upvotes: 0
Views: 459
Reputation: 1535
In the Domain Name System, and most notably, in DNS zone files, a fully qualified domain name is specified with a trailing dot. For example, somehost.example.com. specifies an absolute domain name that ends with an empty top level domain label.
So the PHP is actually returning the correct value. As to how to combat this, use sudhakar's suggestion.
Upvotes: 0
Reputation: 572
i dont think its php issue, but this code can resolve your issue.
trim($_SERVER['HTTP_HOST'], '.')
Upvotes: 2