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: 23934
Status: rejected
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: pts [...] fazekas.hu
Cc:
AdminCc:

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



Subject: CGI::blockquote('foo') clobbers <STDIN>
Download (untitled) / with headers
text/plain 1.4k
Hi! CGI::blockquote('foo') calls CGI::self_or_default(...), which calls CGI::new(), which clobbers STDIN. So if I do a `my $q=new CGI()' afterwards, all my HTTP POST data is lost (since it has to arrive on STDIN). There is no problem with CGI->blockquote('foo'), which calls CGI::self_or_default(...), which doesn't call CGI::new(). I think this is a bug in CGI.pm, because CGI::blockquote('foo') and CGI->blockquote('foo') should do the same thing (and leave Perl in the same state). One solution would be to never call CGI::new: sub CGI::self_or_default { return @_ if defined($_[0]) && (!ref($_[0])) &&($_[0] eq 'CGI'); my $Q=$_[0]; #### pts #### Dat: not permanent unless (defined($Q) && (ref($Q) eq 'CGI' || UNIVERSAL::isa($Q,'CGI')) # slightly optimized for common case ) { #$Q = $CGI::DefaultClass->new unless defined($Q); $Q=$CGI::DefaultClass; #### pts #### unshift(@_,$Q); } return wantarray ? @_ : $Q; } Another solution would be to ignore STDIN in $Q: sub CGI::self_or_default { return @_ if defined($_[0]) && (!ref($_[0])) &&($_[0] eq 'CGI'); my $Q=$_[0]; #### pts #### Dat: not permanent unless (defined($Q) && (ref($Q) eq 'CGI' || UNIVERSAL::isa($Q,'CGI')) # slightly optimized for common case ) { #$Q = $CGI::DefaultClass->new unless defined($Q); $Q = $CGI::DefaultClass->new('') unless defined($Q); #### pts #### unshift(@_,$Q); } return wantarray ? @_ : $Q; } Best regards, Péter Szabó
Download (untitled) / with headers
text/plain 1.7k
On Thu Dec 14 09:17:14 2006, PTS wrote: Show quoted text
> Hi! > > CGI::blockquote('foo') calls CGI::self_or_default(...), which calls > CGI::new(), which clobbers STDIN. So if I do a `my $q=new CGI()' > afterwards, all my HTTP POST data is lost (since it has to arrive on
STDIN). Show quoted text
> > There is no problem with CGI->blockquote('foo'), which calls > CGI::self_or_default(...), which doesn't call CGI::new(). > > I think this is a bug in CGI.pm, because CGI::blockquote('foo') and > CGI->blockquote('foo') should do the same thing (and leave Perl in the > same state). > > One solution would be to never call CGI::new: > > sub CGI::self_or_default { > return @_ if defined($_[0]) && (!ref($_[0])) &&($_[0] eq 'CGI'); > my $Q=$_[0]; #### pts #### Dat: not permanent > unless (defined($Q) && > (ref($Q) eq 'CGI' || UNIVERSAL::isa($Q,'CGI')) # slightly optimized > for common case > ) { > #$Q = $CGI::DefaultClass->new unless defined($Q); > $Q=$CGI::DefaultClass; #### pts #### > unshift(@_,$Q); > } > return wantarray ? @_ : $Q; > } > > > Another solution would be to ignore STDIN in $Q: > > sub CGI::self_or_default { > return @_ if defined($_[0]) && (!ref($_[0])) &&($_[0] eq 'CGI'); > my $Q=$_[0]; #### pts #### Dat: not permanent > unless (defined($Q) && > (ref($Q) eq 'CGI' || UNIVERSAL::isa($Q,'CGI')) # slightly optimized > for common case > ) { > #$Q = $CGI::DefaultClass->new unless defined($Q); > $Q = $CGI::DefaultClass->new('') unless defined($Q); #### pts #### > unshift(@_,$Q); > } > return wantarray ? @_ : $Q; > }
That's for the report and potential patches, Peter. If this issue is still present with CGI.pm 3.43, please submit an automated test case which triggers it. Thanks! Mark
Download (untitled) / with headers
text/plain 120b
No follow-up or test was provided for this since it was first reporting in 2006, so I'm rejecting this change request.


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.