Commits

William Durand committed af31c02 Merge

Merge pull request #28 from felds/patch-1

Prevent alert when /dev/urandom is not accessible

  • Participants
  • Parent commits 6667312, 56f7630

Comments (0)

Files changed (1)

lib/OAuth2/OAuth2.php

    * @see OAuth2::genAuthCode()
    */
   protected function genAccessToken() {
-    if (file_exists('/dev/urandom')) { // Get 100 bytes of random data
+    if (@file_exists('/dev/urandom')) { // Get 100 bytes of random data
       $randomData = file_get_contents('/dev/urandom', false, null, 0, 100);
     } elseif (function_exists('openssl_random_pseudo_bytes')) { // Get 100 bytes of pseudo-random data
       $bytes = openssl_random_pseudo_bytes(100, $strong);