ID:               24548
 Comment by:       alexandre dot alapetite at risoe dot dk
 Reported By:      mikx at mikx dot de
 Status:           Open
 Bug Type:         Unknown/Other Function
 Operating System: Windows 2003 Server
 PHP Version:      4.3.2
 New Comment:

It seems that there is a problem with the get_browser() function.
It is not respecting the browscap.ini format.

For example (with IE6.0 Win2000) in the browscap.ini we can find
[IE 6.0]
which are the generic values for all IE6 browsers.
And is the this wrong one that is returned by get_browser() since the
"IE 6.0" pattern is contained in the user agent string "Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.0; Q312461)".

The good match in browscap.ini for IE6 Win2000 should be
[Mozilla/4\.0 (compatible; MSIE 6\.0.*;.*Windows NT 5\.0.*).*]

The solution for IE6 is to replace in browscap.ini
[IE 6.0] by [Internet Explorer 6.0]
and parent=IE 6.0 by parent=Internet Explorer 6.0

This way it will return also the platform, the browser, etc...

But PHP should update the way they analyse regular expressions from
browscap.ini which are in fact of the form
[^xxx$]. That meens that expressions in browscap.ini are always full
pattern and not just a peace.

Hope it will be corrected soon.


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

[2003-07-08 18:44:56] mikx at mikx dot de

Seems to be a bug in 4.3.2 - downgraded to 4.3.0 and get_browser() is
able to detect the platform of much more HTTP_USER_AGENT strings now.

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

[2003-07-08 16:44:11] mikx at mikx dot de

Just figured out that get_browser() does not return a fixed set of
informations - the platform information is only given if resolved.

It can't resolve most versions of Internet Explorer 6, not sure if this
is a bug or a weakness of the browscap.ini.

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

[2003-07-08 16:20:15] mikx at mikx dot de

Description:
------------
The object returned from get_browser() function does not contain the
platform information as described in the documentation and as usual in
prior versions.

It's more a missing feature than a bug, but it brings some old scripts
relying on this feature into trouble.

The browscap.ini is the latest "official" one from Gary Keith.



Reproduce code:
---------------
$browser = get_browser();
foreach ($browser as $name => $value) {
    print "<b>$name</b> $value <br />\n";
}




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


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

Reply via email to