Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the HTTP-BrowserDetect CPAN distribution.

Report information
The Basics
Id: 41263
Status: resolved
Priority: 0/
Queue: HTTP-BrowserDetect

People
Owner: Nobody in particular
Requestors: cpan.org [...] binary.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.99
Fixed in: (no value)



Subject: Server logs many "Use of uninitialized value" warnings
Server error log has a lot of noise about "Use of uninitialized value" & similar in several places in the module, apparently caused by unrecognised user agents. I have patched the code and attach a diff of my version versus the published v0.99. Note that I have also made changes to detect Iceweasel (see bug #40349) stderr: Use of uninitialized value in string eq at /usr/local/share/perl/5.8.4/HTTP/BrowserDetect.pm line 372. stderr: Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl/5.8.4/HTTP/BrowserDetect.pm line 118. stderr: Argument "." isn't numeric in addition (+) at /usr/local/share/perl/5.8.4/HTTP/BrowserDetect.pm line 118. stderr: Use of uninitialized value in index at /usr/local/share/perl/5.8.4/HTTP/BrowserDetect.pm line 176. stderr: Use of uninitialized value in string eq at /usr/local/share/perl/5.8.4/HTTP/BrowserDetect.pm line 372. perl, v5.8.4 built for i386-linux-thread-multi Linux 2.6.8-2-686-smp #1 SMP Tue Aug 16 12:08:30 UTC 2005 i686 GNU/Linux
Subject: diff-BrowserDetect-0.99.txt
--- /usr/local/share/perl/5.8.8/HTTP/BrowserDetect.pm 2008-10-24 15:04:48.000000000 +0100 +++ BrowserDetect.pm 2008-11-25 09:28:36.000000000 +0000 @@ -85,9 +85,9 @@ # Firefox version - if ($ua =~ /(firefox|firebird|phoenix)/i) { + if ($ua =~ /(firefox|firebird|iceweasel|phoenix)/i) { (undef,$major, $minor) = ($ua =~ / - (firefox|firebird|phoenix) + (firefox|firebird|iceweasel|phoenix) \/ ( [^\.]* ) # Major version number is everything before first dot \. # The first dot @@ -115,7 +115,7 @@ } - $minor = 0+".$minor"; + $minor = 0+('.' . ($minor || 0)); $self->{tests} = {}; my $tests = $self->{tests}; @@ -125,7 +125,6 @@ $tests->{GECKO} = (index($ua,"gecko") != -1); $tests->{FIREFOX} = (index($ua,"firefox") != -1) || (index($ua,"firebird") != -1) || + (index($ua,"iceweasel") != -1) || (index($ua,"phoenix") != -1); $tests->{SAFARI} = (index($ua,"safari") != -1) || (index($ua,"applewebkit") != -1); @@ -174,7 +173,7 @@ $tests->{NAV4UP} = ($tests->{NETSCAPE} && $major >= 4); $tests->{NAV45} = ($tests->{NETSCAPE} && $major == 4 && $minor == .5); $tests->{NAV45UP} = ($tests->{NAV4} && $minor >= .5) || ($tests->{NETSCAPE} && $major >= 5); - $tests->{NAVGOLD} = (index($beta,"gold") != -1); + $tests->{NAVGOLD} = (defined($beta) && index($beta,"gold") != -1); $tests->{NAV6} = ($tests->{NETSCAPE} && $major == 5); # go figure $tests->{NAV6UP} = ($tests->{NETSCAPE} && $major >= 5); @@ -370,7 +369,7 @@ $tests->{VMS} = (index($ua,"vax") != -1 || index($ua,"openvms") != -1); # A final try at browser version, if we haven't gotten it so far - if ($major eq '') { + if (!defined($major) || $major eq '') { if ($ua =~ /[A-Za-z]+\/(\d+)\;/) { $major = $1; $minor = 0;
Thanks very much for your patch! I've applied it manually and added a test for it. It will appear in version 1.01 Best, Olaf