Closed Bug 676430 Opened 14 years ago Closed 14 years ago

When editing a bug, a user not in the timetracking group generates "Use of uninitialized value in abs at Bugzilla/Bug.pm line 2682" in the web server error log

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

4.1.2
defect
Not set
trivial

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

(Keywords: regression)

Attachments

(1 file)

I cannot reproduce in 4.0.1, only in 4.1.2. If I'm not in the timetracking group, editing a bug triggers the following warning in the web server error log: "Use of uninitialized value in abs at Bugzilla/Bug.pm line 2682". The corresponding line is in add_comment(): if ($comment eq '' && !($params->{type} || abs($params->{work_time}))) So work_time is undefined, and Perl 5.12.3 complains.
Flags: blocking4.2+
This is a regression due to bug 590334. In 4.0, _check_work_time() was called before abs(...) and returned 0 if work_time wasn't defined. In 4.2, abs() is called first, making it get an undefined value if the user is not in the timetracking field. Looks like a trivial abs(... || 0) will do it.
Depends on: 590334
mkanat, what do you prefer? abs(work_time || 0), or calling validators before calling abs()?
(In reply to comment #2) > mkanat, what do you prefer? abs(work_time || 0), or calling validators > before calling abs()? Ah, just the || 0 seems like the simpler fix for now.
Attached patch patch, v1Splinter Review
Assignee: create-and-change → LpSolit
Status: NEW → ASSIGNED
Attachment #550910 - Flags: review?(mkanat)
Severity: normal → trivial
Attachment #550910 - Flags: review?(mkanat) → review+
Flags: approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Bug.pm Committed revision 7895.
Status: ASSIGNED → RESOLVED
Closed: 14 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: