Bugzilla 4.0.2+ Integration Errors with Undef values

24 views
Skip to first unread message

R. Gratis

unread,
Jan 30, 2012, 4:14:41 PM1/30/12
to VersionOne-dev
I'm testing out an upgrade to Bugzilla 4.0.3 (latest stable), and the
current VersionOne Bugzilla Integration (8.3, Rev 1462) is throwing
errors when setting the VersionOne URL field in Bugzilla after the
defect is opened in VersionOne.

Errors in the ServiceHost log are something like this:

[ERROR] 30-01-2012 14:43:16 Event Manager Caught Unhandled Exception
CookComputing.XmlRpc.XmlRpcFaultException: Server returned a fault
exception: [-32000] Undef to trick_taint at Bugzilla/Util.pm line 64
Bugzilla::Util::trick_taint(undef) called at Bugzilla/Bug.pm line
3770
Bugzilla::Bug::LogActivityEntry(<bug_id>,<field_name>, undef,
'<defect_url>', <user_id>, '<timestamp>') called at /loader/0x2192594/
Bugzilla/Extension/V1Integration/V1.pm line 180
Bugzilla::Extension::V1Integration::V1::_SaveHistory(<bug_id>,
'<field_name>', undef, '<defect_url>',
'Bugzilla::DB::Mysql=HASH(0x29cb53c)') called at...

Traced this back to a change noted in Bugzilla 4.0.2:
* WebServices methods will return undefined bug fields as undefined
instead of as an empty string. This change is consistent with how
Bugzilla 4.2 behaves. (Bug 657561)
http://www.bugzilla.org/releases/4.0.2/release-notes.html

The URL field in my installation is not defined until the VersionOne
Integration sets it. Looks like the next version of the integration
will need to check for undefined values. I put a quick fix into
_SaveHistory as a workaround; if anyone else needs it, see below.

--Rachel


Edit file V1.pm in <bugzilla_directory>/extensions/V1Integration/lib
and change the subroutine _SaveHistory to include a check that
converts an undefined old value to an empty string before calling
LogActivityEntry.

sub _SaveHistory {
my ($bugid, $fieldname, $oldValue, $fieldvalue, $dbh) = @_;

if ($fieldname eq "assigned_to") {
$oldValue = new Bugzilla::User($oldValue)->name;
$fieldvalue = new Bugzilla::User($fieldvalue)->name;
}

### [RG] 2012.01.30 - Convert undef to an empty string
### to prevent undef from being sent through trick_taint
if (!defined $oldValue) {
$oldValue = '';
}
###

Bugzilla::Bug::LogActivityEntry($bugid, $fieldname, $oldValue,
$fieldvalue, Bugzilla->user->id,
$dbh->selectrow_array("SELECT NOW()"));
}

ibuchanan

unread,
Jan 30, 2012, 4:55:08 PM1/30/12
to VersionOne-dev
Rachel,

Thanks so much for finding this issue and posting a fix for everyone
to leverage. I will make sure the dev team pulls this fix into the
source code and we get a fix out with the next release.

Yours truly,
Ian Buchanan
Product Manager for Platform and Integrations

On Jan 30, 4:14 pm, "R. Gratis" <webmistr...@indyslair.net> wrote:
> I'm testing out an upgrade to Bugzilla 4.0.3 (latest stable), and the
> current VersionOne Bugzilla Integration (8.3, Rev 1462) is throwing
> errors when setting the VersionOne URL field in Bugzilla after the
> defect is opened in VersionOne.
>
> Errors in the ServiceHost log are something like this:
>
> [ERROR] 30-01-2012 14:43:16 Event Manager Caught Unhandled Exception
> CookComputing.XmlRpc.XmlRpcFaultException: Server returned a fault
> exception: [-32000] Undef to trick_taint at Bugzilla/Util.pm line 64
>         Bugzilla::Util::trick_taint(undef) called at Bugzilla/Bug.pm line
> 3770
>         Bugzilla::Bug::LogActivityEntry(<bug_id>,<field_name>, undef,
> '<defect_url>', <user_id>, '<timestamp>') called at /loader/0x2192594/
> Bugzilla/Extension/V1Integration/V1.pm line 180
>         Bugzilla::Extension::V1Integration::V1::_SaveHistory(<bug_id>,
> '<field_name>', undef, '<defect_url>',
> 'Bugzilla::DB::Mysql=HASH(0x29cb53c)') called at...
>
> Traced this back to a change noted in Bugzilla 4.0.2:
> * WebServices methods will return undefined bug fields as undefined
> instead of as an empty string. This change is consistent with how
> Bugzilla 4.2 behaves. (Bug 657561)http://www.bugzilla.org/releases/4.0.2/release-notes.html
>
> The URL field in my installation is not defined until the VersionOne
> Integration sets it.  Looks like the next version of the integration
> will need to check for undefined values.  I put a quick fix into
> _SaveHistory as a workaround; if anyone else needs it, see below.
>
> --Rachel
>
> Edit file V1.pm in <bugzilla_directory>/extensions/V1Integration/lib
> and change the subroutine _SaveHistory to include a check that
> converts an undefined old value to an empty string before calling
> LogActivityEntry.
>
> sub _SaveHistory {
>         my ($bugid, $fieldname,  $oldValue, $fieldvalue, $dbh) = @_;
>
>         if ($fieldname eq "assigned_to") {
>                 $oldValue = new Bugzilla::User($oldValue)->name;
>                 $fieldvalue = new Bugzilla::User($fieldvalue)->name;
>         }
>
> ### [RG] 2012.01.30 - Convert undef to an empty string
> ### to prevent undef from being sent through trick_taint
>         if (!defined $oldValue) {
>                 $oldValue = '';
>         }
> ###
>
>         Bugzilla::Bug::LogActivityEntry($bugid, $fieldname,  $oldValue,
> $fieldvalue, Bugzilla->user->id,
>                 $dbh->selectrow_array("SELECT NOW()"));
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages