]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 477513: md5_hex() fails if a saved search has UTF8 characters in it - Patch by...
authorlpsolit%gmail.com <>
Mon, 9 Feb 2009 19:18:59 +0000 (19:18 +0000)
committerlpsolit%gmail.com <>
Mon, 9 Feb 2009 19:18:59 +0000 (19:18 +0000)
Bugzilla/Token.pm

index f87490db19e197f250dce805889716fb8ca910fc..4aee0561ec497cbf8db73cd8e5078de05f4d105b 100644 (file)
@@ -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.