Closed Bug 254430 Opened 20 years ago Closed 20 years ago

can_see_bug borks for logged out user.

Categories

(Bugzilla :: Creating/Changing Bugs, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: kiko, Assigned: bugreport)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Probably a regression from the Bugzilla->user changes we made for logged out
users. Basically, viewing a bug while logged out is getting me:

Can't call method "can_see_bug" on an undefined value at Bugzilla/Bug.pm line 159.

I think that's a bit weird to say the least, but my tree has no mods and it's
showing up like that. I have a band-aid but I'm not committing to it yet.
Attached patch kiko_v0: a hack? (obsolete) — Splinter Review
I'm not taking this, just suggesting a fix. Is it okay to use Bugzilla there? I
don't know..
Keywords: regression
Priority: -- → P1
Target Milestone: --- → Bugzilla 2.20
ugh!  why were they creating a new object there?

That looks like the right fix.  I dont see any reason not to call
Buigzilla->user from Bug.pm.  Why not?
It is kind of silly to create a "userid=0" user, but let's fix this in User.pm
so we dont have to worry about other wacky places.
Attachment #155267 - Attachment is obsolete: true
Attachment #155288 - Flags: review?(kiko)
We should fix all the code that play the userid=0 ==> logged out card and update
it.  But, that should be a different bug.
Attachment #155288 - Flags: review?(justdave)
Can you at least do a mini-audit and see where else we create new objects to
ensure there are no time bombs like this left over?
Status: NEW → ASSIGNED
There are a bunch of places that pass userid to the constructor.  It is hard to
say if any of them play the zero trick, but this fix completes the emulation of
that so we should be ok.

The only other direct calls into Bugzilla::User are for the wildcard match and
it takes care of going through Bugzilla->user already.
Comment on attachment 155288 [details] [diff] [review]
Fix - new with userid zero returns logged out user

Ah, so the problem is that return undef? Can you add a comment explaining that
if you pass in a bogus/nonexistant ID we bail out with undef?

Also add a comment there explaining that we return a dead user in this
situation so people can track this down easily.

I'm not sure why that callsite creates a new user either, but maybe
Bugzilla::Bug can't depend on Bugzilla.pm?
Attachment #155288 - Flags: review?(kiko) → review+
Flags: approval?
Flags: approval? → approval+
checked in
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Attachment #155288 - Flags: review?(justdave)
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: