https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114272

Revision: 114272
Author:   reedy
Date:     2012-03-20 14:21:27 +0000 (Tue, 20 Mar 2012)
Log Message:
-----------
Followup r114270 (essentially reverts it), and r114233, use class member 
variables as they are already defined

Modified Paths:
--------------
    trunk/phase3/includes/CryptRand.php

Modified: trunk/phase3/includes/CryptRand.php
===================================================================
--- trunk/phase3/includes/CryptRand.php 2012-03-20 14:21:11 UTC (rev 114271)
+++ trunk/phase3/includes/CryptRand.php 2012-03-20 14:21:27 UTC (rev 114272)
@@ -187,9 +187,8 @@
         * @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 @@
 
                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 @@
         * @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;
        }
 
        /**


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to