diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 5a2306d1..a30ed77f 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -40,7 +40,14 @@ $kind_to_string = array($kind_user => "user", $kind_agent => "agent", $kind_for_ function next_token() { - return function_exists('openssl_random_pseudo_bytes') ? hexdec(bin2hex(openssl_random_pseudo_bytes(4))) : mt_rand(99999, 99999999); + if (function_exists('openssl_random_pseudo_bytes')) { + $token_arr = unpack('N', "\x0" . openssl_random_pseudo_bytes(3)); + $token = $token_arr[1]; + } + else { + $token = mt_rand(99999, 99999999); + } + return $token; } function next_revision($link)