summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-02-09 20:18:59 +0100
committerlpsolit%gmail.com <>2009-02-09 20:18:59 +0100
commitc23619f179ccb6c3dfdfdf3991a16ca8e2d5bf31 (patch)
tree1f046fbb0c87a6187afcb129ce916f50407e8aea
parentf65a3e7e20fdfe2f136ecdaa228f0784bb56b9ad (diff)
downloadbugzilla-c23619f179ccb6c3dfdfdf3991a16ca8e2d5bf31.tar.gz
bugzilla-c23619f179ccb6c3dfdfdf3991a16ca8e2d5bf31.tar.xz
Bug 477513: md5_hex() fails if a saved search has UTF8 characters in it - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=LpSolit
-rw-r--r--Bugzilla/Token.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm
index f87490db1..4aee0561e 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.