For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > September 2005 > #34683 [Ver->Csd]: get_browser ignores $_SERVER['HTTP_USER_AGENT'] setting









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #34683 [Ver->Csd]: get_browser ignores $_SERVER['HTTP_USER_AGENT'] setting
vrana@php.net

2005-09-30, 3:56 am

ID: 34683
Updated by: vrana@php.net
Reported By: skissane at gmail dot com
-Status: Verified
+Status: Closed
Bug Type: Documentation problem
Operating System: Irrelevant
PHP Version: Irrelevant
New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.

"By default, the value of HTTP User-Agent header is used."


Previous Comments:
------------------------------------------------------------------------

[2005-09-30 10:19:32] sniper@php.net

It does use the HTTP_USER_AGENT. But it does not use it from
$_SERVER['HTTP_USER_AGENT'], this is a documentation error.
(you can't just change any pre-set $_SERVER values!)

You need to pass the function the different browser agent string if you
think the one found in $_SERVER['HTTP_USER_AGENT'] isn't correct.


------------------------------------------------------------------------

[2005-09-30 07:52:01] skissane at gmail dot com

Description:
------------
According to the docs "By default, the value of
$_SERVER['HTTP_USER_AGENT'] is used". However, setting this to a
different value does not change the output of get_browser with no
arguments. Indeed, under CLI SAPI, HTTP_USER_AGENT is not set
initially, and even if you set it by hand before calling get_browser()
it still gives an error that it is not set.

Reproduce code:
---------------
Run from CLI SAPI:
<?
$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-GB; rv:1.7.10) Gecko/20050717 Firefox/1.0.6";
echo is_object(get_browser($_SERVER["HTTP_USER_AGENT"])) ? "Y" : "N";
echo is_object(get_browser()) ? "Y" : "N";


Expected result:
----------------
YY

Actual result:
--------------
Y
Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot
determine user agent name in /data/www/simon/Handbook/test.php on line
4
N


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=34683&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com