Commits

Felds Liscia  committed 56f7630

Prevent alert when /dev/urandom is not accessible

>> Warning: file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/dev/urandom) is not within the allowed path(s): (/usr/lib/php:/usr/local/lib/php:/tmp) in /.../vendor/friendsofsymfony/oauth2-php/lib/OAuth2/OAuth2.php line 1190

  • Participants
  • Parent commits e56ce04

Comments (0)

Files changed (1)

File 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);