소스 검색

Make use of random_bytes for better uniqueness

Jordi Boggiano 9 년 전
부모
커밋
85792c8818
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/Monolog/Processor/UidProcessor.php

+ 1 - 1
src/Monolog/Processor/UidProcessor.php

@@ -26,7 +26,7 @@ class UidProcessor
             throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32');
         }
 
-        $this->uid = substr(hash('md5', uniqid('', true)), 0, $length);
+        $this->uid = substr(bin2hex(random_bytes((int) ceil($length / 2))), 0, $length);
     }
 
     public function __invoke(array $record): array