Bug #9484: Ensure we always get 23 character string
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Jan 2011 09:10:09 +0000 (02:10 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Jan 2011 09:10:09 +0000 (02:10 -0700)
framework/Support/lib/Horde/Support/Randomid.php

index 815e6eb..f1b3bbc 100644 (file)
@@ -48,7 +48,7 @@ class Horde_Support_Randomid
     {
         // Base64 can have /, +, and = characters. Restrict to URL-safe characters.
         return str_replace(array('/', '+', '='), array('-', '_', ''), base64_encode(
-            pack('II', mt_rand(), crc32(php_uname('n'))) . pack('H*', uniqid() . dechex(getmypid()))
+            pack('II', mt_rand(), crc32(php_uname('n'))) . pack('H*', uniqid() . sprintf('%04s', dechex(getmypid())))
         ));
     }