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: 25131
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: at [...] altlinux.ru
Cc:
AdminCc:

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

Attachments
0001-closes-RT-25131-do-not-clobber-_-in-init.patch



Subject: [PATCH] CGI.pm (init): do not clobber $_
Date: Sun, 25 Feb 2007 00:36:35 +0300
To: bug-cgi.pm [...] rt.cpan.org
From: Alexey Tourbin <at [...] altlinux.ru>
Download (untitled) / with headers
text/plain 528b
--- CGI.pm | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/CGI.pm b/CGI.pm index 96232da..b87f178 100644 --- a/CGI.pm +++ b/CGI.pm @@ -559,6 +559,7 @@ sub init { } if (defined($fh) && ($fh ne '')) { + local $_; while (<$fh>) { chomp; last if /^=/; @@ -574,6 +575,7 @@ sub init { } if (defined($fh) && ($fh ne '')) { + local $_; while (<$fh>) { chomp; last if /^=/; -- 1.5.0.1.GIT
Download (untitled) / with headers
text/plain 759b
Thanks for the patch! To move this forward, next we'll need an automated test that illustrates the problem with the unpatched code. Mark On Sat Feb 24 16:15:52 2007, at@altlinux.ru wrote: Show quoted text
> --- > CGI.pm | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/CGI.pm b/CGI.pm > index 96232da..b87f178 100644 > --- a/CGI.pm > +++ b/CGI.pm > @@ -559,6 +559,7 @@ sub init { > } > > if (defined($fh) && ($fh ne '')) { > + local $_; > while (<$fh>) { > chomp; > last if /^=/; > @@ -574,6 +575,7 @@ sub init { > } > > if (defined($fh) && ($fh ne '')) { > + local $_; > while (<$fh>) { > chomp; > last if /^=/;
Download (untitled) / with headers
text/plain 374b
On Wed Jul 22 22:03:35 2009, MARKSTOS wrote: Show quoted text
> Thanks for the patch! > > To move this forward, next we'll need an automated test that illustrates > the problem with the unpatched code. > > Mark > >
Attached is a patch for both an automated test and the fix. You can also see it at http://github.com/bubaflub/CGI.pm/commit/759c8385eb3a371309b869be76c49a6880ddd73a.
From 759c8385eb3a371309b869be76c49a6880ddd73a Mon Sep 17 00:00:00 2001 From: Bob Kuo <bob@celect.org> Date: Sun, 23 Aug 2009 16:33:00 -0500 Subject: [PATCH] closes RT #25131 - do not clobber $_ in init --- lib/CGI.pm | 1 + t/init.t | 13 +++++++++++++ t/init_test.txt | 3 +++ 3 files changed, 17 insertions(+), 0 deletions(-) create mode 100644 t/init.t create mode 100644 t/init_test.txt diff --git a/lib/CGI.pm b/lib/CGI.pm index eec56cb..3f64320 100644 --- a/lib/CGI.pm +++ b/lib/CGI.pm @@ -615,6 +615,7 @@ sub init { } if (defined($fh) && ($fh ne '')) { + local $_; while (<$fh>) { chomp; last if /^=$/; diff --git a/t/init.t b/t/init.t new file mode 100644 index 0000000..532a277 --- /dev/null +++ b/t/init.t @@ -0,0 +1,13 @@ +#!/usr/bin perl -w + +use strict; +use Test::More tests => 1; + +use CGI; + + +$_ = "abcdefghijklmnopq"; +my $IN; +open ($IN, "t/init_test.txt"); +my $q = CGI->new($IN); +is($_, 'abcdefghijklmnopq', 'make sure not to clobber $_ on init'); diff --git a/t/init_test.txt b/t/init_test.txt new file mode 100644 index 0000000..3101583 --- /dev/null +++ b/t/init_test.txt @@ -0,0 +1,3 @@ +A=B +D=F +G=H -- 1.6.3.1
Thanks for the report and patch. This is now resolved in my github repo.
Subject: Thanks, released
Download (untitled) / with headers
text/plain 160b
The patch for this ticket has now been released in CGI.pm 3.47, and this ticket is considered resolved. Thanks again for you help to improve CGI.pm! Mark


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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