Merge "else if -> elseif"
[lhc/web/wiklou.git] / includes / CryptRand.php
index fcf6a39..d0305d8 100644 (file)
@@ -79,7 +79,7 @@ class MWCryptRand {
                // Include some information about the filesystem's current state in the random state
                $files = array();
 
-               // We know this file is here so grab some info about ourself
+               // We know this file is here so grab some info about ourselves
                $files[] = __FILE__;
 
                // We must also have a parent folder, and with the usual file structure, a grandparent
@@ -106,7 +106,11 @@ class MWCryptRand {
                                        }
                                }
                                // The absolute filename itself will differ from install to install so don't leave it out
-                               $state .= realpath( $file );
+                               if( ( $path = realpath( $file ) ) !== false ) {
+                                       $state .= $path;
+                               } else {
+                                       $state .= $file;
+                               }
                                $state .= implode( '', $stat );
                        } else {
                                // The fact that the file isn't there is worth at least a
@@ -144,7 +148,7 @@ class MWCryptRand {
        /**
         * Randomly hash data while mixing in clock drift data for randomness
         *
-        * @param $data string The data to randomly hash.
+        * @param string $data The data to randomly hash.
         * @return String The hashed bytes
         * @author Tim Starling
         */
@@ -158,7 +162,7 @@ class MWCryptRand {
                $buffer = str_repeat( ' ', $bufLength );
                $bufPos = 0;
 
-               // Iterate for $duration seconds or at least $minIerations number of iterations
+               // Iterate for $duration seconds or at least $minIterations number of iterations
                $iterations = 0;
                $startTime = microtime( true );
                $currentTime = $startTime;
@@ -464,8 +468,8 @@ class MWCryptRand {
         * You can use MWCryptRand::wasStrong() if you wish to know if the source used
         * was cryptographically strong.
         *
-        * @param $bytes int the number of bytes of random data to generate
-        * @param $forceStrong bool Pass true if you want generate to prefer cryptographically
+        * @param int $bytes the number of bytes of random data to generate
+        * @param bool $forceStrong Pass true if you want generate to prefer cryptographically
         *                          strong sources of entropy even if reading from them may steal
         *                          more entropy from the system than optimal.
         * @return String Raw binary random data
@@ -480,8 +484,8 @@ class MWCryptRand {
         * You can use MWCryptRand::wasStrong() if you wish to know if the source used
         * was cryptographically strong.
         *
-        * @param $chars int the number of hex chars of random data to generate
-        * @param $forceStrong bool Pass true if you want generate to prefer cryptographically
+        * @param int $chars the number of hex chars of random data to generate
+        * @param bool $forceStrong Pass true if you want generate to prefer cryptographically
         *                          strong sources of entropy even if reading from them may steal
         *                          more entropy from the system than optimal.
         * @return String Hexadecimal random data