Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 72882
Status: resolved
Worked: 5 min
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: perl [...] max-maurer.de
Cc:
AdminCc:

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



With some calls the pattern match in "user_agent" seems to be uninitilized. Use of uninitialized value in pattern match (m//) at (eval 923) line 4. at (eval 923) line 4 CGI::user_agent('MSIE\s+3\.0[12];\s*Mac|DreamPassport') called at (eval 922) line 15 MultipartBuffer::new('MultipartBuffer', 'CGI=HASH(0x25bfd40)', '---------------------8ce7d315bde28d1', 585) called at (eval 920) line 4 CGI::new_MultipartBuffer('CGI=HASH(0x25bfd40)', '---------------------8ce7d315bde28d1', 585) called at (eval 919) line 3 CGI::read_multipart('CGI=HASH(0x25bfd40)', '---------------------8ce7d315bde28d1', 585) called at /usr/share/perl/5.10/CGI.pm line 553 CGI::init('CGI=HASH(0x25bfd40)') called at /usr/share/perl/5.10/CGI.pm line 370 CGI::new('CGI') called at
Subject: Problem with user_agent and undefined pattern
A patch checking wether match is defined before checking for its contents
Subject: 0001-user_agent-regular-expressions-are-now-also-checked-.patch
From 1369abd9b4ebbea3b7274341bb875facf60f1dbb Mon Sep 17 00:00:00 2001 From: gooroo175 <gooroo175@googlemail.com> Date: Thu, 1 Dec 2011 10:01:15 +0100 Subject: [PATCH] user_agent regular expressions are now also checked for being defined. This threw an unnecessary warning. --- lib/CGI.pm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/CGI.pm b/lib/CGI.pm index 9138fe1..0b21b84 100644 --- a/lib/CGI.pm +++ b/lib/CGI.pm @@ -3167,7 +3167,7 @@ END_OF_FUNC sub user_agent { my($self,$match)=self_or_CGI(@_); my $user_agent = $self->http('user_agent'); - return $user_agent unless $match && $user_agent; + return $user_agent unless defined $match && $match && $user_agent; return $user_agent =~ /$match/i; } END_OF_FUNC -- 1.7.4.msysgit.0
Subject: Re: [rt.cpan.org #72882] Problem with user_agent and undefined pattern
Date: Fri, 02 Dec 2011 08:54:15 -0500
To: bug-cgi.pm [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Thanks. There is a duplicate report for somewhere that was just waiting for the patch. I'll find that ticket, merge and release this fix.
Thanks, I'm committing this patch to Git today. Mark