Closed Bug 315605 Opened 19 years ago Closed 19 years ago

Bugzilla::Field::check_form_field() should not take a CGI object as parameter

Categories

(Bugzilla :: Bugzilla-General, defect)

2.21
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

Attachments

(1 file, 1 obsolete file)

When using non-cgi scripts, no CGI object is (or should be) available, and so we cannot use Bugzilla::Field::check_form_field*() to validate fields. These methods should accept a hash of the form {field_name => $field_value} instead of $cgi. This problem appears at least in importxml.pl.
Instead of a hash, why not just check_field_defined($value, $fieldName)?
Assignee: general → LpSolit
Severity: enhancement → normal
Target Milestone: Bugzilla 2.24 → Bugzilla 2.22
Oh also, we should remove the word "form" from the function name, since it won't only be working on forms anymore.
Attached patch patch, v1 (obsolete) — Splinter Review
I finally wrote ($name, $value, ...) instead of a hash, as suggested by mkanat.
Attachment #202321 - Flags: review?(wurblzap)
Status: NEW → ASSIGNED
Summary: Bugzilla::Field::check_form_field*() should take a hash instead of a CGI object as parameter → Bugzilla::Field::check_form_field() should not take a CGI object as parameter
Blocks: 285614
Attachment #202321 - Flags: review?(wurblzap) → review?(wicked)
Comment on attachment 202321 [details] [diff] [review] patch, v1 >Index: Bugzilla/Field.pm >=================================================================== >-# Fr&#65533;&#65533;ic Buclin <LpSolit@gmail.com> >+# Frédéric Buclin <LpSolit@gmail.com> This was a nasty change and made my patch attempt to fail for some reason. It took few hours but I finally got it to apply. :) Otherwise this seems to change code logic nicely.
Attachment #202321 - Flags: review?(wicked) → review+
Flags: approval?
This is too invasive to a critical procedure for 2.22 this close to release. Lets's check it in after we branch.
Target Milestone: Bugzilla 2.22 → Bugzilla 2.24
Flags: approval? → approval+
The patch has completely bitrotten due to custom fields. I will update it later this week.
Comment on attachment 202321 [details] [diff] [review] patch, v1 FWIW, we were going to just move the check_form_field sub to CGI.pm... that would have worked, also.
(In reply to comment #7) > (From update of attachment 202321 [details] [diff] [review] [edit]) > FWIW, we were going to just move the check_form_field sub to CGI.pm... that > would have worked, also. Oh, I see why you didn't do that. Okay :-)
The patch I'm checking in.
Attachment #202321 - Attachment is obsolete: true
Checking in post_bug.cgi; /cvsroot/mozilla/webtools/bugzilla/post_bug.cgi,v <-- post_bug.cgi new revision: 1.136; previous revision: 1.135 done Checking in process_bug.cgi; /cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v <-- process_bug.cgi new revision: 1.305; previous revision: 1.304 done Checking in Bugzilla/Field.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Field.pm,v <-- Field.pm new revision: 1.11; previous revision: 1.10 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: