#27291 [Com]: get_browser matches browscap.ini patterns incorrectly

From: Date: Tue, 24 Feb 2004 02:14:20 +0000
Subject: #27291 [Com]: get_browser matches browscap.ini patterns incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-55428@lists.php.net to get a copy of this message
 ID:               27291
 Comment by:       php_bug_27291 at garykeith dot com
 Reported By:      php-bug-NOSPAM-2004 at ryandesign dot com
 Status:           Open
 Bug Type:         *General Issues
 Operating System: *
 PHP Version:      4CVS, 5CVS (2004-02-20)
 New Comment:

In looking at browscap.ini with all Gecko-based browsers now using
Gecko/* instead of Gecko/???????? I can find no reason why Netscape 7.x
should have a problem with my definitions. I mean, what's wrong with
the following browscap.ini definition?

Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape7/7.2*

By any reasonable standard it should recognize this user agent as
Netscape 7.2. In my tests using browscap.dll that's exactly what it
did.

Have I found yet another bug? Or did I completely miss what you were
trying to tell me?

Thanks for the tip about Camino. I don't see it very often in my logs.
I've added the plus version to my database but haven't published it
yet.

I will bundle up all the files you requested and make them available on
one of my servers. I'll e-mail you privately once that's done as I do
not want to publicize the URL, LOL.


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

[2004-02-23 17:25:44] php-bug-NOSPAM-2004 at ryandesign dot com

Yes, I'm sorry, I meant to mention that changing to 
match Gecko/* instead of Gecko/???????? would seem to 
adversely affect Netscape 7.x, whose UA string starts 
the same way, but ends, after the Gecko/xxx part, with 
Netscape/xxx.

Other things you should look out for in your file: I 
think you may be missing a pattern for the Camino 
browser version 0.7+. That's what you get if you use the 
latest nightly builds, which is effortlessly achieved by 
using the program CaminoKnight, and since 0.7 proper is 
so ancient now, most Camino users probably are running 
the 0.7+ builds. The UA string ends with the + sign but 
seems otherwise the same to what you have in the 2/15/04 
file.

Confirmed that the new browscap.ini from 2/15/04 causes 
a parse error at Apache startup. Filed http://
bugs.php.net/27372

Sorry about my shorthand... by .tgz I just meant a 
compressed file. A Zip file would be fine too. If you 
could bundle up your huge UA list, and possibly also 
your script to feed these to browscap.dll, and put them 
on a web or ftp server like Jay did or just email them 
to me, that'd be great.

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

[2004-02-23 16:46:16] php_bug_27291 at garykeith dot com

Sorry I forgot to address your proposal.

You do need IIS to use browscap.dll. The problem is you cannot pass a
user agent to it directly like you can with PHP. I have a script (in
ASP/VBScript obviously, but probably easily converted to PHP) that lets
you pass a specific user agent to browscap.dll and get the resulting
browser in return.

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

[2004-02-23 16:39:22] php_bug_27291 at garykeith dot com

Tell me what a .tgz file is and if I can do it I will.

I'm working two new bugs that I hope someone will post bug reports
about.

The first deals with the exclamation point that's part of the new
Yahoo! Slurp crawler. I'm not sure what PHP is doing since I don't
speak PHP but I'm told it's throwing a parsing error.

I've also had some complaints from people saying user agents aren't
being recognized since I switched from using Gecko/???????? to Gecko/*
as we discussed earlier.

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

[2004-02-23 12:58:19] php-bug-NOSPAM-2004 at ryandesign dot com

Sounds like what we need is a script that takes the user 
agents logged by a popular web site, runs them through 
browscap.dll and PHP's get_browser(), compares the 
results, and informs a PHP programmer about any 
differences, so that get_browser() can be kept in line.

I hate to volunteer for such a task, as I'm not a member 
of the PHP team, but perhaps, once my patch or one like 
it is applied, I could try it out for awhile to see what 
quantity of diffs is generated.

I'm not sure, however, how I would use browscap.dll. 
What kind of server would need to be used, and what 
programming language? I have a feeling you're going to 
say Microsoft IIS and Visual Basic or ASP or some such, 
none of which I've ever worked with. (I wouldn't know 
where to begin.) But if a system could be developed 
whereby one popular web server gathers a day's UA's, and 
then passes it off to both a script using browscap.dll 
and a second one using PHP's get_browser(), and then 
takes the results, compares them, and saves out only the 
differences, and then emails or FTPs a .tgz to me or 
someone, that might be a place to start. I'd be happy to 
help with such a script, tho like I said I wouldn't know 
how to tackle the browscap.dll part.

I looked through all the diffs between the PHP 4.3.4 
get_browser() matching and the results after applying my 
patch on Jay's user agent file, and I'm encouraged by 
the results. I think they're more accurate. I think it 
should improve the situation greatly. Gary, if you'd 
like to send your huge 20,000-entry user agent list in a 
.tgz I could do some more comparisons and see how the 
patch holds up.

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

[2004-02-23 12:01:41] php_bug_27291 at garykeith dot com

Jay, whom can I contact at PHP to let them know I no longer want to be
the official source of browscap.ini for PHP? In the past two days I've
had two bug reports, both of which only happen in PHP. When
browscap.dll is doing the parsing it works fine.

I'm fed up with PHP. I waste more of my time dealing with bugs in PHP
than any other aspect of my project and it's just not worth it to me
anymore.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/27291

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


Thread (17 messages)

« previous php.bugs (#55428) next »