Closed Bug 825718 Opened 12 years ago Closed 12 years ago

Bugzilla::Bug->check() doesn't support the new caching mechanism

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: LpSolit, Assigned: glob)

References

Details

(Keywords: regression)

Attachments

(1 file)

Try to access a bug you are not allowed to see. You get the following error message:

  You are not authorized to access bug #HASH(0x9915b38).

That's because Bugzilla::Bug->check() doesn't support the new caching mechanism implemented in bug 811280. It still expects to get a scalar (either bug id or alias), not a hash.
Assignee: general → glob
Attached patch patch v1Splinter Review
Attachment #697095 - Flags: review?(LpSolit)
Comment on attachment 697095 [details] [diff] [review]
patch v1

>=== modified file 'Bugzilla/Bug.pm'

>-    ThrowUserError('improper_bug_id_field_value', { field => $field }) unless defined $id;
>+    ThrowUserError('improper_bug_id_field_value', { field => $field }) unless defined $param;

What must really be tested is if a bug ID has been passed or not. Because if $param is {id => undef, cache => 1}, then this error would no longer be thrown, because $param itself exists, but with no bug ID defined. That's a regression. So this check must be moved after $id is set below.


>+    if (ref($param)) {
>+        $param->{id} = trim($param->{id});
>+        $id = $param->{id};

You can simply write: $id = $param->{id} = trim($param->{id}); on a single line.


>+    } else {
>+        $param = trim($param);
>+        $id = $param;

Same here: $id = $param = trim($param);


>+    my $self = $class->new($param);

The error above should come right before this call, now that we have $id in hands.


r=LpSolit with these comments fixed.
Attachment #697095 - Flags: review?(LpSolit) → review+
Status: NEW → ASSIGNED
Flags: approval+
Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Bug.pm
Committed revision 8549.
Status: ASSIGNED → RESOLVED
Closed: 12 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: