php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20462 get_browser() does not correct parse browscap.ini
Submitted: 2002-11-17 04:28 UTC Modified: 2002-11-17 21:16 UTC
From: ml at mled dot net Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.3.0-pre2 OS: Redhat 8.0
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: ml at mled dot net
New email:
PHP Version: OS:

 

 [2002-11-17 04:28 UTC] ml at mled dot net
hello,

i tried different browser with get_browsers, and had a lot of trouble.
for me, it seems that get_browser() does not recognize the question mark '?' as joker sign if there is no asterisk '*'.

testet browsers (on a win2000):
ie 5 ok
mozilla 1.x, netscape 6/7, opera 6.2/7b not work

sample script:
    $ua = "Mozilla/5.0 (Windows; ?; Windows NT 5.0; ??-??; rv:1.1) Gecko/????????";
    print "<b>user_agent exact as written in browscap.ini:</b> [$ua]<br />";
    fPrintBrowser( get_browser($ua) ) ;
    $ua= $_SERVER["HTTP_USER_AGENT"];
    print "<b>user_agent as it browser sends:</b> [$ua]<br />";
    fPrintBrowser( get_browser($ua) ) ;

    function fPrintBrowser($browser) {
        print "<b>pattern: </b>" . $browser->browser_name_pattern ."<br />";
        print "<b>browser: </b>" . $browser->browser ."<br />";
    }

sample output:
    user_agent exact as written in browscap.ini: [Mozilla/5.0 (Windows; ?; Windows NT 5.0; ??-??; rv:1.1) Gecko/????????]
    pattern: Mozilla/5\.0 (Windows; .; Windows NT 5\.0; ..-..; rv:1\.1) Gecko/........
    browser: Mozilla

    user_agent as it browser sends: [Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826]
    pattern: .*
    browser: Default

browscap.ini from http://www.garykeith.com/ (November 13, 2002):
entry (line 5522) don't work:
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; ??-??; rv:1.1) Gecko/????????]

modified entry which works (asterisk at the end):
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; ??-??; rv:1.1) Gecko/????????*]

thanks!
markus

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-17 20:59 UTC] sniper@php.net
Verified with: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20021110


 [2002-11-17 21:16 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 18:01:35 2024 UTC