Last Comment Bug 576911 - The "before_table" hook throws "uninitialized value" errors in the web server log
: The "before_table" hook throws "uninitialized value" errors in the web server...
Status: RESOLVED FIXED
:
Product: Bugzilla
Classification: Server Software
Component: Administration (show other bugs)
: 3.7
: All All
: -- minor (vote)
: Bugzilla 3.6
Assigned To: Max Kanat-Alexander
: default-qa
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-04 15:55 PDT by Frédéric Buclin
Modified: 2010-07-07 00:10 PDT (History)
2 users (show)
LpSolit: approval+
LpSolit: blocking4.0+
LpSolit: approval3.6+
LpSolit: blocking3.6.2+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
v1 (921 bytes, patch)
2010-07-06 15:35 PDT, Max Kanat-Alexander
LpSolit: review-
Details | Diff | Splinter Review
v2 (1.02 KB, patch)
2010-07-06 17:30 PDT, Max Kanat-Alexander
LpSolit: review+
Details | Diff | Splinter Review

Description Frédéric Buclin 2010-07-04 15:55:16 PDT
When listing components (editcomponents.cgi), the following errors appear:

editcomponents.cgi: Use of uninitialized value $template_name in concatenation (.) or string at Bugzilla/Template/Plugin/Hook.pm line 60.
editcomponents.cgi: Use of uninitialized value $type in concatenation (.) or string at Bugzilla/Template/Plugin/Hook.pm line 60.

The corresponding line in Hook.pm is:

  my $extension_template = "$path$template_name-$hook_name.$type.tmpl";

They are undefined because these variables are defined by:

    $filename =~ m/(.+)\.(.+)\.tmpl$/;
    my $template_name = $1;
    my $type = $2;

but $filename contains the name of the component instead of "list.html.tmpl". This problem doesn't occur when listing milestones or versions.
Comment 1 Frédéric Buclin 2010-07-04 16:01:29 PDT
(In reply to comment #0)
> but $filename contains the name of the component instead of "list.html.tmpl".

Oh, I'm pretty sure this is because of this line:

$template ||= $context->stash->{component}->{name};

component.name is probably overriden by the name of the product's component, which explains why this problem only happens when listing components.
Comment 2 Frédéric Buclin 2010-07-04 16:02:41 PDT
Marking as blocker for further investigation.
Comment 3 Max Kanat-Alexander 2010-07-06 15:35:47 PDT
Created attachment 456208 [details] [diff] [review]
v1

I actually can't reproduce that warning. However, does this fix it for you?
Comment 4 Frédéric Buclin 2010-07-06 17:26:37 PDT
Comment on attachment 456208 [details] [diff] [review]
v1

It does, but now user IDs are displayed instead of login names.
Comment 5 Frédéric Buclin 2010-07-06 17:28:42 PDT
Comment on attachment 456208 [details] [diff] [review]
v1

>+[% FOREACH my_component = product.components %]
>   [% overrides.initialowner.name.${component.name} = {

>   [% overrides.initialqacontact.name.${component.name} = {

You forgot to replace component by my_component here too.
Comment 6 Max Kanat-Alexander 2010-07-06 17:30:14 PDT
Created attachment 456213 [details] [diff] [review]
v2

Ah, right. :-)
Comment 7 Frédéric Buclin 2010-07-06 17:35:50 PDT
Comment on attachment 456213 [details] [diff] [review]
v2

Now works fine. Thanks! r=LpSolit
Comment 8 Max Kanat-Alexander 2010-07-06 17:38:23 PDT
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/
modified template/en/default/admin/components/list.html.tmpl
Committed revision 7286.

Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/3.6/
modified template/en/default/admin/components/list.html.tmpl
Committed revision 7123.

Note You need to log in before you can comment on or make changes to this bug.