MWCryptHash::hmac requires a string, but mt_rand() returns an integer.
This issue resulted in an uncaught exception in a fresh installation
of mediawiki.
Imported from https://github.com/wikimedia/mediawiki/pull/55
Change-Id: Idccf5f230bfc2de30357b03c78c51cdad4839515
": Falling back to using a pseudo random state to generate randomness.\n" );
}
while ( strlen( $buffer ) < $bytes ) {
- $buffer .= MWCryptHash::hmac( $this->randomState(), mt_rand() );
+ $buffer .= MWCryptHash::hmac( $this->randomState(), strval( mt_rand() ) );
// This code is never really cryptographically strong, if we use it
// at all, then set strong to false.
$this->strong = false;