]> 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:20:40 +0000 (19:20 +0000)
committerlpsolit%gmail.com <>
Mon, 9 Feb 2009 19:20:40 +0000 (19:20 +0000)
Bugzilla/Token.pm

index a54da4af59848ab8dac507ac6efd9c939d8a07b7..a8862bd5a4e75fe97b7e34c15b08201046877a8c 100644 (file)
@@ -181,7 +181,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.