From 01bd22e29c9b427915e7c9076f82c916c376cd04 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 10 Aug 2010 20:25:57 -0600 Subject: [PATCH] Tweaks to new randomid algorithm --- framework/Support/lib/Horde/Support/Randomid.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/Support/lib/Horde/Support/Randomid.php b/framework/Support/lib/Horde/Support/Randomid.php index 150effcfe..4ca64929a 100644 --- a/framework/Support/lib/Horde/Support/Randomid.php +++ b/framework/Support/lib/Horde/Support/Randomid.php @@ -46,7 +46,9 @@ class Horde_Support_Randomid */ public function generate() { - $this->_rid = rtrim(base64_encode(pack('H*', strtr(uniqid(mt_rand(), true), array('.' => '')) . dechex(getmypid()))), '='); + /* Base64 can have /, +, and = characters. Restrict to just + * numbers and letters. */ + $this->_rid = str_replace(array('/', '+', '='), 0, base64_encode(pack('H*', mt_rand() . strtr(uniqid('', true), '.', '') . dechex(getmypid())))); } /** -- 2.11.0