note 110741 deleted from function.http-negotiate-language by aharvey
| From: | aharvey@php.net | Date: | Mon, 03 Dec 2012 01:13:29 +0000 |
| Subject: | note 110741 deleted from function.http-negotiate-language by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192254@lists.php.net to get a copy of this message | ||
Note Submitter: just me
----
@ Anonymous 03-Nov-2008 07:23
Your code:
<?php
// if $http_accept_language was left out, read it from the HTTP-Header
if ($http_accept_language == "auto") $http_accept_language =
$_SERVER['HTTP_ACCEPT_LANGUAGE'];
?>
assumes that HTTP_ACCEPT_LANGUAGE will be set, when, in fact, it is not usually set by non-browser
clients like cURL, bots, webcrawlers and therelike.
The code should be changed to:
<?php
// if $http_accept_language was left out, read it from the HTTP-Header
if ($http_accept_language == "auto")
$http_accept_language = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ?
$_SERVER['HTTP_ACCEPT_LANGUAGE'] : "";
?>