Open Bug 1892558 Opened 3 months ago Updated 3 months ago

Error when trying displaying bug after creation.

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

Harmony
defect

Tracking

()

People

(Reporter: me, Assigned: me, NeedInfo)

Details

Set up a Harmony install on Ubuntu Server LTE 22.02 using MySQL 5.x and use the

perl Makefile.PL
make cpanfile GEN_CPANFILE_ARGS="-D better_xff -D jsonrpc -D xmlrpc -D mysql"
carton install

to install after apt install git nano build-essential libexpat1-dev mysql-server libmysqlclient-dev perlmagick graphviz python3-sphinx rst2pdf carton and initial database setup.

Log in as the administrative user and create a new bug. After saving the new bug, get the error:

2024/04/20 06:13:01  ERROR | Bugzilla.Error.Template | undef error - Can't locate object method "has_extension" via package "Bugzilla" at /var/www/webapps/bugzilla/extensions/BugModal/Extension.pm line 209

in the log, as well as a similar message on the web UX.

The new bug does appear in search results, but the error appears again when trying to view the bug.

The error happens in extensions/BugModal/Extension.pm:

 # bugzilla-readable-status 
  my @flags = map { {name => $_->name, status => $_->status} } @{$bug->flags};
  $vars->{readable_bug_status_json} = encode_json({
    dupe_of          => $bug->dup_id,
    id               => $bug->id,
    keywords         => [map { $_->name } @{$bug->keyword_objects}],
    priority         => $bug->priority,
    resolution       => $bug->resolution,
    status           => $bug->bug_status,
    flags            => \@flags,
    target_milestone => $bug->target_milestone,
    Bugzilla->has_extension('TrackingFlags')
    ? map { $_->name => $_->bug_flag($bug->id)->value } @{$vars->{tracking_flags}}
    : {},
  });
  # HTML4 attributes cannot be longer than this, so just skip it in this case.
  if (length($vars->{readable_bug_status_json}) > 65536) {
    delete $vars->{readable_bug_status_json};
  }

If I remove that block the error does not occur.

Looking at the same file in BMO, Bugzilla->has_extension() is not called and any tracking flags associated with the bug are added via:

map { $_->name => $_->bug_flag($bug->id)->value } @{$vars->{tracking_flags}},

If I make that change instead of removing the block, then displaying the bug after creation, or from search results also works without error.

Also this file is the only place Bugzilla->has_extension() is called in Harmony, so that may be a change in the bmo branch that needed to be cherry picked.

@dklawren, do we need that block anymore? I thought the readable_bug_statuses extension had been removed from BMO. But this JSON blob might be used in social media previews.

Flags: needinfo?(dklawren)
Assignee: create-and-change → me
Flags: needinfo?(mozilla)
You need to log in before you can comment on or make changes to this bug.