]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/random_compat/random_bytes_mcrypt.php
WordPress 4.5
[autoinstalls/wordpress.git] / wp-includes / random_compat / random_bytes_mcrypt.php
index 5a1b688f602bf33647b0eea78b065027cd310d53..7ac9d9105fe5cafe5e20c8c25b1580a0e9ed33db 100644 (file)
@@ -48,6 +48,7 @@ function random_bytes($bytes)
             'random_bytes(): $bytes must be an integer'
         );
     }
+
     if ($bytes < 1) {
         throw new Error(
             'Length must be greater than 0'
@@ -55,14 +56,17 @@ function random_bytes($bytes)
     }
 
     $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM);
-    if ($buf !== false) {
-        if (RandomCompat_strlen($buf) === $bytes) {
-            /**
-             * Return our random entropy buffer here:
-             */
-            return $buf;
-        }
+    if (
+        $buf !== false
+        &&
+        RandomCompat_strlen($buf) === $bytes
+    ) {
+        /**
+         * Return our random entropy buffer here:
+         */
+        return $buf;
     }
+
     /**
      * If we reach here, PHP has failed us.
      */