Closed Bug 298507 Opened 20 years ago Closed 19 years ago

several uninitialized values used in editwhines.cgi

Categories

(Bugzilla :: Whining, defect)

2.19.3
defect
Not set
trivial

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: karl, Assigned: karl)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)

When filling in the subject of a newly-created whining event, an error is
generated in the error_log, presumably because the original subject or body was
never defined.

Reproducible: Always

Steps to Reproduce:
1. Log into Bugzilla tip with an account that can modify its own whines.
2. Access editwhines.cgi
3. Create a new wining event
4. In the empty form that appears, fill in the subject AND NOTHING ELSE

Actual Results:  
The following error was logged in the error.log:

editwhines.cgi: Use of uninitialized value in string ne at
/Library/WebServer/Documents/bugzilla-new/editwhines.cgi line 150.

Expected Results:  
I expected to see zero errors generated when loading the page.

This is using the version of editwhines.cgi from tip.
Summary: whine subject used unitialized value in editwhines.cgi → whine subject used unitialized value in editwhines.cgi
Version: unspecified → 2.19.3
Blocks: bz-warnings
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch Patch v1 (obsolete) — Splinter Review
I was actually off by one.  It wasn't $subject or $body that was failing, it
was $events->{$eventid}->{'subject'} and $events->{$eventid}->{'body'}.

It seems that when a new whining event is created (lines 88-95), NULL is used
as the default values for subject and body, which makes the subject/body in the
hash undefined.

I guess this is the most basic solution.  Before the comparison around line
150, the hash is checked and any undef values are reaplaced with an empty
string.
Attachment #188080 - Flags: review?(LpSolit)
Comment on attachment 188080 [details] [diff] [review]
Patch v1

>+                $events->{$eventid}->{'subject'} |= '';
>+                $events->{$eventid}->{'body'} |= '';

The right fix is to modify get_events(), assuming we don't want to store empty
strings into the 'whine_events' table:

$events->{$ev} = {
    'subject' => $sub || '',
    'body' => $bod || '',
};
Attachment #188080 - Flags: review?(LpSolit) → review-
Assignee: erik → karl
Target Milestone: --- → Bugzilla 2.20
*** Bug 298509 has been marked as a duplicate of this bug. ***
Status: NEW → ASSIGNED
Summary: whine subject used unitialized value in editwhines.cgi → several uninitialized values used in editwhines.cgi
Attached patch Patch v2Splinter Review
modifies attachment 188080 [details] [diff] [review] with respect to comment 2
Attachment #188080 - Attachment is obsolete: true
Attachment #188119 - Flags: review?(LpSolit)
Comment on attachment 188119 [details] [diff] [review]
Patch v2

r=LpSolit
Attachment #188119 - Flags: review?(LpSolit) → review+
Flags: approval?
Note that there is still a potential undefined value at line 194 due to:
if ($cgi->param("mailto_type_$sid") == MAILTO_USER)

I still don't understand how $cgi->param("mailto_type_$sid") could be undefined.
Flags: blocking2.20+
Flags: approval?
Flags: approval+
Checking in editwhines.cgi;
/cvsroot/mozilla/webtools/bugzilla/editwhines.cgi,v  <--  editwhines.cgi
new revision: 1.7; previous revision: 1.6
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

Creator:
Created:
Updated:
Size: