php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50267 get_browser with null parameter runs on empty user agent string
Submitted: 2009-11-23 05:18 UTC Modified: 2009-11-24 02:39 UTC
From: nachumk at gmail dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 5.3.1 OS: Windows XP 32 bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nachumk at gmail dot com
New email:
PHP Version: OS:

 

 [2009-11-23 05:18 UTC] 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).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-23 05:20 UTC] 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-24 00:18 UTC] svn@php.net
Automatic comment from SVN on behalf of jani
Revision: http://svn.php.net/viewvc/?view=revision&revision=291250
Log: Fixed bug #50267 (get_browser(null) does not use HTTP_USER_AGENT)
 [2009-11-24 00:18 UTC] jani@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2009-11-24 02:39 UTC] nachumk at gmail dot com
Thank you
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC