For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > September 2005 > #34683 [Opn->Ver]: 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 [Opn->Ver]: get_browser ignores $_SERVER['HTTP_USER_AGENT'] setting
sniper@php.net

2005-09-30, 3:56 am

ID: 34683
Updated by: sniper@php.net
Reported By: skissane at gmail dot com
-Status: Open
+Status: Verified
-Bug Type: Unknown/Other Function
+Bug Type: Documentation problem
-Operating System: Linux (FC4)
+Operating System: Irrelevant
-PHP Version: 5.0.5
+PHP Version: Irrelevant
New Comment:

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.



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

[2005-09-30 10:12:22] skissane at gmail dot com

Sniper, what renders this "bogus"? The docs imply it behaves a certain
way... and it doesn't. Either the docs are wrong or the code is wrong
-- either way there is a bug.

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

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

Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.



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

[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