php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21468 get_browser() still has bugs
Submitted: 2003-01-06 12:50 UTC Modified: 2003-01-06 15:43 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gary at garykeith dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.3.0 OS: Various
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gary at garykeith dot com
New email:
PHP Version: OS:

 

 [2003-01-06 12:50 UTC] gary at garykeith dot com
I am the developer who maintains the browscap.ini file that is recommended by PHP. Despite some recent bug fixes there still seems to be at least one bug in the get_browser() function.

Simply put, multiple question marks surrounded by white space in a user agent definition in browscap.ini creates some sort of error that results in a valid user agent not being recognized by get_browser().

Here's a more detailed example of what I mean. 

user agent: Mozilla/4.8 [en] (Windows NT 5.0; U)
original browscap.ini definition: Mozilla/4.8 ???? (Windows NT 5.0; U)
updated browscap.ini definition: Mozilla/4.8*(Windows NT 5.0; U)

The original definition resulted in the user agent not being found and the Default browser being returned. The updated definition works fine. This forms the basis of my theory about multiple question marks surrounded by white space. By the way, both definitions are valid and both work just fine on other platforms such as ASP.

With the help of a fellow developer we did some further testing to confirm my theory.

The following user agent definitions did not result in a match when presented with a user agent that should have created a match:

Mozilla/4.76C-CCK-MCD  ???? (X11; ?; SunOS 5.? sun4u)
Mozilla/4.76C-CCK-MCD vg_472 ???? (X11; ?; SunOS 5.8 sun4u)
Mozilla/4.76C-SGI ???? (X11; ?; IRIX64 6.5 IP30)
Mozilla/4.79C-CCK-MCD  ???? (X11; ?; SunOS 5.6 sun4u)

But these did result in matches:

Mozilla/4.79 ????*(Win95; ?)
Mozilla/4.78 (Windows 2000; U) Opera 6.05  ????
Mozilla/5.0 (BeOS; ?; BeOS BePC; ?????; rv:1.0.?) Gecko/????????

This seems to suggest a problem only when multiple question marks are surrounded on both sides by white space.

I hope this is enough information for someone to attempt a fix.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-06 15:43 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 15:01:34 2024 UTC