#50267 [Opn->Fbk]: get_browser with null parameter runs on empty user agent string

From: Date: Mon, 23 Nov 2009 15:44:08 +0000
Subject: #50267 [Opn->Fbk]: get_browser with null parameter runs on empty user agent string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144966@lists.php.net to get a copy of this message
 ID:               50267
 Updated by:       jani@php.net
 Reported By:      nachumk at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         *General Issues
 Operating System: Windows XP 32 bit
 PHP Version:      5.3.1
 New Comment:

FYI: Since PHP 5.3.0 you can use the "real" browscap.ini too: 
  
  http://browsers.garykeith.com/stream.asp?BrowsCapINI

Can you please provide shorter and complete example script with real
expected result (and actual) instead of the one you used now? I don't
quite understand what the problem here is..


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

[2009-11-23 14:06:52] nachumk at gmail dot com

http://browsers.garykeith.com/stream.asp?PHP_BrowsCapINI
downloaded 
yesterday. Keep in mind that it works fine if I give it the 
parameter $_SERVER['HTTP_USER_AGENT'], showing that browscap is 
installed correctly. It seems to be an issue in php's ability to 
retrieve the user agent on it's own.

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

[2009-11-23 10:07:01] jani@php.net

And what browscap.ini are you using..? 

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

[2009-11-23 05:20:35] nachumk at gmail dot com

I am running Apache 2.2.14
(apache_2.2.14-win32-x86-openssl-0.9.8k.msi), 
PHP 5.3.1 (php-5.3.1-Win32-VC9-x86.msi (both as module and cgi), and 
php-5.3.1-nts-Win32-VC9-x86.msi), on Windows XP 32 bit.

It works when I run PHP 5.2.11.

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

[2009-11-23 05:18:19] nachumk at gmail dot com

Description:
------------
get_browser should work with null string and doesn't when using 5.3.1.

5.2.11 works fine.

Reproduce code:
---------------
<?php
phpinfo();
echo "User Agent: " . $_SERVER['HTTP_USER_AGENT'] . "<br>";
echo 'print_r(get_browser($_SERVER[\'HTTP_USER_AGENT\'], true));<br>';
print_r(get_browser($_SERVER['HTTP_USER_AGENT'], true));
echo '<br>print_r(get_browser(null, true))<br>';
print_r(get_browser(null, true));
?>


Expected result:
----------------
That both get_browser calls should produce identical results.

Actual result:
--------------
The first call with $_SERVER['HTTP_USER_AGENT'] returns proper results

and the call with null returns a default response (same as what it
would 
return with a completely empty user agent string).


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


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



Thread (11 messages)

« previous php.bugs (#144966) next »