mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
"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
This commit is contained in:
parent
ba5713391d
commit
41d0e78681
1 changed files with 2 additions and 2 deletions
|
@ -136,13 +136,13 @@ class String extends Object {
|
||||||
$pid = getmypid();
|
$pid = getmypid();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$pid) {
|
if (!$pid || $pid > 65535) {
|
||||||
$pid = mt_rand(0, 0xfff) | 0x4000;
|
$pid = mt_rand(0, 0xfff) | 0x4000;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($timeMid, $timeLow) = explode(' ', microtime());
|
list($timeMid, $timeLow) = explode(' ', microtime());
|
||||||
$uuid = sprintf("%08x-%04x-%04x-%02x%02x-%04x%08x", (int)$timeLow, (int)substr($timeMid, 2) & 0xffff,
|
$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;
|
return $uuid;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue