From 1c283f2a413f00d752c9f49d74008c4cb00a7c86 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 20 Mar 2012 14:21:27 +0000 Subject: [PATCH] Followup r114270 (essentially reverts it), and r114233, use class member variables as they are already defined --- includes/CryptRand.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/includes/CryptRand.php b/includes/CryptRand.php index 37f5ed7465..9f0f7de1ee 100644 --- a/includes/CryptRand.php +++ b/includes/CryptRand.php @@ -187,9 +187,8 @@ class MWCryptRand { * @return String A hash algorithm */ protected function hashAlgo() { - static $algo; - if ( !is_null( $algo ) ) { - return $algo; + if ( !is_null( $this->algo ) ) { + return $this->algo; } $algos = hash_algos(); @@ -197,9 +196,9 @@ class MWCryptRand { foreach ( $preference as $algorithm ) { if ( in_array( $algorithm, $algos ) ) { - $algo = $algorithm; # assign to static - wfDebug( __METHOD__ . ": Using the $algo hash algorithm.\n" ); - return $algo; + $this->algo = $algorithm; + wfDebug( __METHOD__ . ": Using the {$this->algo} hash algorithm.\n" ); + return $this->algo; } } @@ -218,11 +217,10 @@ class MWCryptRand { * @return int Number of bytes the hash outputs */ protected function hashLength() { - static $hashLength; - if ( is_null( $hashLength ) ) { - $hashLength = strlen( $this->hash( '' ) ); + if ( is_null( $this->hashLength ) ) { + $this->hashLength = strlen( $this->hash( '' ) ); } - return $hashLength; + return $this->hashLength; } /** -- 2.20.1