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: 37365
Status: resolved
Worked: 2 min
Priority: 0/
Queue: CGI

People
Owner: LDS [...] cpan.org
Requestors: chris [...] pirazzi.net
Cc:
AdminCc:

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



MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,DK_SIGNED,SPF_PASS
Content-Disposition: inline
content-type: text/plain; charset="utf-8"
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 96DC54D80A0 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 3 Jul 2008 01:21:29 -0400 (EDT)
Received: (qmail 8238 invoked from network); 3 Jul 2008 05:21:28 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 3 Jul 2008 05:21:28 -0000
Received: from wa-out-1112.google.com (HELO wa-out-1112.google.com) (209.85.146.179) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Jul 2008 22:21:25 -0700
Received: by wa-out-1112.google.com with SMTP id n7so410312wag.13 for <bug-CGI.pm [...] rt.cpan.org>; Wed, 02 Jul 2008 22:21:20 -0700 (PDT)
Received: by 10.115.22.1 with SMTP id z1mr7870100wai.99.1215062480099; Wed, 02 Jul 2008 22:21:20 -0700 (PDT)
Received: by 10.114.168.8 with HTTP; Wed, 2 Jul 2008 22:21:20 -0700 (PDT)
Delivered-To: cpan-bug+CGI.pm [...] diesel.bestpractical.com
Subject: BUG $query->Vars tied hash regression: exists() now fails, worked before
Return-Path: <cpirazzi [...] gmail.com>
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=DZMPo8gmAGnVno5a2HnoDNGvLovL/3j1ODacbkiEdtKIIi6VZx1fWI0qE2nJ7AXJST tZMUqfJ3RRP/LTlWecBzRlSSyJz2hHSehbnxZDra8pLACrZrmJ3Kbk/BGErWHuJKN43J j3vxXq9dGtJ2zsIoDGVt7V6OHUoWlin8XjYIY=
X-Original-To: bug-CGI.pm [...] rt.cpan.org
X-Spam-Check-BY: 16.mx.develooper.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=TZ0ArQBJPRD6eAwExJ7+I8J24qfhh8TppbtALsseiSQ=; b=Bp+1P+1E0YNEh9s49gmZQTCg5Mq0MFYkHH7voBIUoCwGezZ7OolSobVt/V8+cVKJnu CeulRA8Th6NI7RdIr6lbLMyKR2rUrDYx5DGbTQX4rHYftWzR32TiYKN+egGhv3YJfEA5 IW8SjwEnv67p0lTbiAzlHo/R/y+jektHT7zNw=
X-Google-Sender-Auth: dd0963ac746e0bb1
Date: Thu, 3 Jul 2008 12:21:20 +0700
Sender: cpirazzi [...] gmail.com
X-Spam-Level: *
Message-Id: <8c6c30ef0807022221o5b83e7a5pb73ca8107bb01f65 [...] mail.gmail.com>
To: bug-CGI.pm [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: "Chris Pirazzi" <chris [...] pirazzi.net>
X-RT-Original-Encoding: ISO-8859-1
Content-Length: 1060
CGI.pm version: 3.38 Perl version: v5.8.8 built for i686-linux Linux 2.6.9-67.0.7.ELsmp #1 SMP Sat Mar 15 06:54:55 EDT 2008 i686 i686 i386 GNU/Linux This is something which has broken in the last few months, though I'm not sure exactly which version of CGI caused it. When you use the tied hash returned by $query->Vars, exists() always returns false. It used to return the correct value. There is an EXISTS routine (autoloaded) in CGI.pm but I cannot figure out why it is not used/working. Run the following short script to see the problem: #!/usr/bin/perl use English; use strict; use CGI qw/-oldstyle_urls/; # use '&' in $query->query_string, not ';' use CGI::Util; my $query = new CGI(); my $inparams = {$query->Vars}; # plain hash my $inparams2 = $query->Vars; # tied hash print "Content-Type: text/html\n\n"; foreach my $k (keys %$inparams) { print "[$k] [$inparams->{$k}] [" . exists($inparams->{$k}) . "] [" . exists($inparams2->{$k}) . "]<br>\n"; } Notice how the real hash gives you 1 for exists, but the tied hash gives you 0.
MIME-Version: 1.0
In-Reply-To: <8c6c30ef0807022221o5b83e7a5pb73ca8107bb01f65 [...] mail.gmail.com>
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Charset: utf8
References: <8c6c30ef0807022221o5b83e7a5pb73ca8107bb01f65 [...] mail.gmail.com>
Message-Id: <rt-3.6.HEAD-31304-1217342955-1952.37365-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1217342955-31304-23"
From: todd_lewis [...] unc.edu
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 299
Download (untitled) / with headers
text/plain 299b
I can confirm this. 3.37 did not have this bug; 3.38 does. The problem is line 1179 of CGI.pm. The 3.38 code reads: sub EXISTS { exists $_[0]->{$_[1]}; } while it should read like so: sub EXISTS { exists $_[0]->{param}{$_[1]}; } The attached file demonstrates the problem quite nicely.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Type: multipart/mixed; boundary="----------=_1217342954-31304-22"
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: application/x-perl; name="exists_test.pl"
Content-Disposition: inline; filename="exists_test.pl"
Content-Transfer-Encoding: base64
Content-Length: 704
Download exists_test.pl
text/x-perl 704b
#!/usr/bin/perl -w # exists_test.pl: Test the 'exists' function on the tied hash of CGI parameters. # Invoke like so: # exists_test.pl a=1 b=2 c=3 use strict; use CGI; my %input; CGI::ReadParse(\%input); print CGI::Dump(),"\n"; print join ', ', keys %input, "\n"; for my $k ( keys %input ) { print "Key: '$k', ", (exists $input{$k} ? 'does ' : 'does not '), "exist"; print " (yet it has value '$input{$k}')" if $input{$k}; print ".\n"; print "Deleting \$input{$k}.\n"; delete $input{$k}; print "Key: '$k', ", (exists $input{$k} ? 'does ' : 'does not '), "exist"; print " (yet it has value '$input{$k}')" if $input{$k}; print ".\n"; print "\n"; }
MIME-Version: 1.0
In-Reply-To: <8c6c30ef0807022221o5b83e7a5pb73ca8107bb01f65 [...] mail.gmail.com>
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Disposition: inline
Charset: utf8
References: <8c6c30ef0807022221o5b83e7a5pb73ca8107bb01f65 [...] mail.gmail.com>
Message-Id: <rt-3.6.HEAD-31279-1217343771-795.37365-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 71
This was broken in version 3.38 only, and is now fixed in version 3.39.


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.