From: lpsolit%gmail.com <> Date: Mon, 9 Feb 2009 19:18:59 +0000 (+0000) Subject: Bug 477513: md5_hex() fails if a saved search has UTF8 characters in it - Patch by... X-Git-Tag: bugzilla-3.3.4~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c23619f179ccb6c3dfdfdf3991a16ca8e2d5bf31;p=thirdparty%2Fbugzilla.git Bug 477513: md5_hex() fails if a saved search has UTF8 characters in it - Patch by Frédéric Buclin r=mkanat a=LpSolit --- diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index f87490db19..4aee0561ec 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -180,7 +180,13 @@ sub issue_hash_token { # The concatenated string is of the form # token creation time + site-wide secret + user ID + data my @args = ($time, Bugzilla->localconfig->{'site_wide_secret'}, Bugzilla->user->id, @$data); - my $token = md5_hex(join('*', @args)); + + my $token = join('*', @args); + # Wide characters cause md5_hex() to die. + if (Bugzilla->params->{'utf8'}) { + utf8::encode($token) if utf8::is_utf8($token); + } + $token = md5_hex($token); # Prepend the token creation time, unencrypted, so that the token # lifetime can be validated.