The browscap file as downloaded from browser.garykeith.com has semicolon (;) and single-quote (') characters in the section strings, either of which will cause parse_ini_file() to abort and return FALSE.

CommentFileSizeAuthor
#2 107762.patch706 bytespillarsdotnet

Comments

pillarsdotnet’s picture

When I contacted Gary Keith regarding this issue, he replied as follows:

Hi Bob,

Thanks for contacting me. This is an issue I've been aware of for some time
now. Several people have filed bug reports about this issue, only to be
rudely dismissed by the person who maintains the get_browser code for PHP.
His reply was always along the lines of, this is by design therefore it's
not a bug. And yet, there doesn't seem to be any workout I can implement
within the browscap.ini file itself, because the characters you mentioned
can't be removed. The semicolon, for example, is a required token separator.
My suggestion has always been to start using the PHP class Jonathan Stoppani
wrote that's available for download on my site. It's supposed to be far more
efficient than get_browser, and it can use the native browscap.ini file.
Perhaps you can get your code included in the core code for the get_browser
function. Eventually I will have to deprecate both php_browscap.ini and
lite_php_browscap.ini.

Regards,
~gary.

pillarsdotnet’s picture

Status: Active » Needs review
StatusFileSize
new706 bytes

A simple workaround is to simply backslash-escape the offending characters.

pillarsdotnet’s picture

Priority: Normal » Critical

Upgrading to critical because without this change, the whole module is basically useless.

greggles’s picture

Title: Correct errors in the downloaded browscap file. » Correct errors in the downloaded browscap file
Status: Needs review » Fixed

I changed this just to add a single space after the commas in the function arguments per Drupal coding style.

7.x-1.x http://drupal.org/commitlog/commit/890/fdd70223e6aedf03fc718d10e3e9b2f16...
6.x-1.x http://drupal.org/commitlog/commit/890/9d1156007b6e71c5928bff2c1b090104f...

Thanks, pillarsdotnet!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.