Closed Bug 1236463 Opened 10 years ago Closed 10 years ago

checksetup.pl errors 'Can't call method "name" on an undefined value at Bugzilla/FlagType.pm line 419'

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mokhi64, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36 Steps to reproduce: i ran ./checksetup.pl in fresh install (after writing some exts) Actual results: error me about : Can't call method "name" on an undefined value at Bugzilla/FlagType.pm line 419 Expected results: it should goes forward normally
this is my extensions i'm trying to add to Bugzilla https://github.com/m0khi/bugzilla/tree/future-branch
The problem is because products (and components) with zero id never get added to the %products hash. https://github.com/bugzilla/bugzilla/blob/master/Bugzilla/FlagType.pm#L419 I'm tempted to change https://github.com/bugzilla/bugzilla/blob/master/Bugzilla/FlagType.pm#L375 to if (defined $prod_id) but we use 0 as an invalid value in the else { } part... Can you try making it so there is no products.id = 0 or components.id = 0 in the database? If that fixes the error, we could update the schema so new dbs never have a zero in either table. I'd like to fix the actual bug though :-)
Flags: needinfo?(mokhi64)
Also, this is confirmed. I ran into it when testing out the modal UI port.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #8703632 - Flags: review?(dylan)
(In reply to Dylan William Hardison [:dylan] from comment #2) > Can you try making it so there is no products.id = 0 or components.id = 0 in > the database? I don't see how you could have the product ID or component ID be 0. These columns are auto-incremented by the DB server itself. If you manually insert ID 0, then that's not our bug, but a bug in the extension.
Comment on attachment 8703632 [details] [diff] [review] patch for Bugzilla/FlagType.pm > foreach my $product_id (@changed_product_ids) { >+ if (defined($products)) { >+ $user->in_group('editcomponents', $product_id) >+ || ThrowUserError('product_access_denied', >+ { name => $products{$product_id}->name }); >+ } > } The problem is not that $products is not defined, the problem is that your specific product ID doesn't exist. Product ID = 0 has a special meaning in this code.
Attachment #8703632 - Flags: review?(dylan) → review-
As I recall this was resolved not be bugzilla's fault.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(mokhi64)
Resolution: --- → INVALID
For the record, I'm seeing the same issue with BMO's Needinfo extension. What happens is that an admin can create a flag from editflagtypes.cgi, which does indeed pass ["0:0"] to the inclusion array by default. However, if you do this within an extension's install_update_db, you get the above error message. The "solution" I'm doing is to set the super user in the install_update_db code, but not sure if that's the right approach.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: