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:
Low/Low

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

BugTracker
Severity:
Normal
Broken in:
0.99
Fixed in:
(no value)



Subject: Server logs many "Use of uninitialized value" warnings
MIME-Version: 1.0
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Charset: utf8
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1227788080-24143-29"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 1014
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
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1227788080-24143-28"
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: text/plain; charset="utf-8"; name="diff-BrowserDetect-0.99.txt"
Content-Disposition: inline; filename="diff-BrowserDetect-0.99.txt"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: ascii
Content-Length: 1964
--- /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;
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-3617-1256011702-98.41263-0-0@rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 128
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


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.