Closed Bug 302200 Opened 19 years ago Closed 19 years ago

uninitialized value when saving email prefs

Categories

(Bugzilla :: Bugzilla-General, defect)

2.19.3
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: robzilla, Assigned: robzilla)

References

Details

Attachments

(1 file, 2 obsolete files)

When you save your e-mail prefs and you don't have all of the items in the
"Global options" section checked, you get uninitialized value messages.
Status: NEW → ASSIGNED
Attached patch robzilla_v1 (obsolete) β€” β€” Splinter Review
Attachment #190553 - Flags: review?
Blocks: bz-warnings
Comment on attachment 190553 [details] [diff] [review]
robzilla_v1

>     foreach my $event (GLOBAL_EVENTS) {
>-        if (1 == $cgi->param("email-" . REL_ANY . "-$event")) {
>+        if (defined($cgi->param("email-" . REL_ANY . "-$event")) &&
>+            1 == $cgi->param("email-" . REL_ANY . "-$event")) {
>             $dbh->do("INSERT INTO email_setting " . 
>                      "(user_id, relationship, event) " . 
>                      "VALUES ($userid, " . REL_ANY . ", $event)");

This patch works *but*:

1) if ($cgi->param("email-" . REL_ANY . "-$event")) would suffice. But as this
is done this way in the rest of the file, I won't deny review due to that.

2) This should be written:

if (defined($cgi->())
    && $cgi->() == 1) 
{

Please update this patch taking into account my comment 2).
Attachment #190553 - Flags: review? → review+
Attached patch robzilla_v2 (obsolete) β€” β€” Splinter Review
ok, nit #2 fixed.
Attachment #190553 - Attachment is obsolete: true
Attachment #190560 - Flags: review?(LpSolit)
Comment on attachment 190560 [details] [diff] [review]
robzilla_v2

>+        if (defined($cgi->param("email-" . REL_ANY . "-$event"))
>+            && $cgi->param("email-" . REL_ANY . "-$event") == 1) {

Reread my previous comment and note the position of the bracket '{'.

If the test can be written on one line:

if ($foo eq $bar) {
    ....
}

If the test requires several lines:

if ($foo eq $bar
    && $id1 != $id2)
{
    ...
}
Attachment #190560 - Flags: review?(LpSolit)
Attached patch robzilla_v3 β€” β€” Splinter Review
Attachment #190560 - Attachment is obsolete: true
Attachment #190562 - Flags: review?(LpSolit)
Comment on attachment 190562 [details] [diff] [review]
robzilla_v3

r=LpSolit
Attachment #190562 - Flags: review?(LpSolit) → review+
Flags: approval?
Flags: approval2.20?
Target Milestone: --- → Bugzilla 2.20
Flags: approval?
Flags: approval2.20?
Flags: approval2.20+
Flags: approval+
tip:

Checking in userprefs.cgi;
/cvsroot/mozilla/webtools/bugzilla/userprefs.cgi,v  <--  userprefs.cgi
new revision: 1.79; previous revision: 1.78
done


2.20rc1:

Checking in userprefs.cgi;
/cvsroot/mozilla/webtools/bugzilla/userprefs.cgi,v  <--  userprefs.cgi
new revision: 1.75.4.3; previous revision: 1.75.4.2
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: