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

People
Owner: MARKSTOS [...] cpan.org
Requestors: rlucas [...] tercent.com
Cc:
AdminCc:

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



Subject: empty name/value, when saved, prevents proper restore from filehandle.
The "save to filehandle" and "retrieve from filehandle" functions sometimes don't do a round-trip properly, if there exists in a submitted form page: <input type="radio" name="" value="" checked /> This causes a single line with only an equals on it (the empty string for both name and value). When CGI reads this in, it does a last LOOP on the regex matching /^=/. Either change the last LOOP to a next LOOP or filter out blank named items from the save to filehandle functionality
On Wed Jun 08 19:11:12 2005, guest wrote: Show quoted text
> The "save to filehandle" and "retrieve from filehandle" functions > sometimes don't do a round-trip properly, if there exists in a > submitted form page: > > <input type="radio" name="" value="" checked /> > > This causes a single line with only an equals on it (the empty string > for both name and value). When CGI reads this in, it does a last LOOP > on the regex matching /^=/. > > Either change the last LOOP to a next LOOP or filter out blank named > items from the save to filehandle functionality
Thanks for the report. From looking at 3.43, it looks like the issue might still exist, because this line is still there: last if /^=/; Would you be willing to submit an automated test case which illustrates triggering this issue, as well as your proposed fix for it? Mark
Given that the documentation of the save() method mentions that it uses a lone '=' as a session separator, I recommend skipping blank param-value pairs in save(). Such a param is of little value anyway, IMHO. Note that the BoulderIO documentation doesn't say anything about unnamed parameters, so I assume that a query string such as "=foo;=bar" should be preserved. This implies that the "last" condition should change to /^=$/. See http://github.com/rhesa/CGI.pm/commit/d22626ab9eb2fb7a82b43ac26cf49fe022d9b147 for the fix (+tests).
Thanks, Rhesa. Your patch has now been reviewed and accepted and published to my github repo. Mark
Subject: Thanks, released
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