From 41d0e78681d8b35d97db5952c8572b3e2e9cc239 Mon Sep 17 00:00:00 2001 From: phpnut Date: Sat, 22 Dec 2007 20:05:34 +0000 Subject: [PATCH] "Correcting String::uuid(); output when $pid > 65535" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6202 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/string.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cake/libs/string.php b/cake/libs/string.php index a85db0065..eae2d24ac 100644 --- a/cake/libs/string.php +++ b/cake/libs/string.php @@ -136,13 +136,13 @@ class String extends Object { $pid = getmypid(); } - if (!$pid) { + if (!$pid || $pid > 65535) { $pid = mt_rand(0, 0xfff) | 0x4000; } list($timeMid, $timeLow) = explode(' ', microtime()); $uuid = sprintf("%08x-%04x-%04x-%02x%02x-%04x%08x", (int)$timeLow, (int)substr($timeMid, 2) & 0xffff, - mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3f) | 0x80, mt_rand(0, 0xff), substr($pid, 0, 5), $node); + mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3f) | 0x80, mt_rand(0, 0xff), $pid, $node); return $uuid; }