r114283 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114282‎ | r114283 | r114284 >
Date:17:22, 20 March 2012
Author:dantman
Status:ok
Tags:
Comment:
Backport r114272, Reedy's fix for r114233 to REL1_17, REL1_18, and REL1_19.
Modified paths:
  • /branches/REL1_17/phase3/includes/CryptRand.php (modified) (history)
  • /branches/REL1_18/phase3/includes/CryptRand.php (modified) (history)
  • /branches/REL1_19/phase3/includes/CryptRand.php (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/includes/CryptRand.php
@@ -187,8 +187,8 @@
188188 * @return String A hash algorithm
189189 */
190190 protected function hashAlgo() {
191 - if ( !is_null( $algo ) ) {
192 - return $algo;
 191+ if ( !is_null( $this->algo ) ) {
 192+ return $this->algo;
193193 }
194194
195195 $algos = hash_algos();
@@ -196,9 +196,9 @@
197197
198198 foreach ( $preference as $algorithm ) {
199199 if ( in_array( $algorithm, $algos ) ) {
200 - $algo = $algorithm; # assign to static
201 - wfDebug( __METHOD__ . ": Using the $algo hash algorithm.\n" );
202 - return $algo;
 200+ $this->algo = $algorithm;
 201+ wfDebug( __METHOD__ . ": Using the {$this->algo} hash algorithm.\n" );
 202+ return $this->algo;
203203 }
204204 }
205205
@@ -217,10 +217,10 @@
218218 * @return int Number of bytes the hash outputs
219219 */
220220 protected function hashLength() {
221 - if ( is_null( $hashLength ) ) {
222 - $hashLength = strlen( $this->hash( '' ) );
 221+ if ( is_null( $this->hashLength ) ) {
 222+ $this->hashLength = strlen( $this->hash( '' ) );
223223 }
224 - return $hashLength;
 224+ return $this->hashLength;
225225 }
226226
227227 /**
Index: branches/REL1_18/phase3/includes/CryptRand.php
@@ -187,8 +187,8 @@
188188 * @return String A hash algorithm
189189 */
190190 protected function hashAlgo() {
191 - if ( !is_null( $algo ) ) {
192 - return $algo;
 191+ if ( !is_null( $this->algo ) ) {
 192+ return $this->algo;
193193 }
194194
195195 $algos = hash_algos();
@@ -196,9 +196,9 @@
197197
198198 foreach ( $preference as $algorithm ) {
199199 if ( in_array( $algorithm, $algos ) ) {
200 - $algo = $algorithm; # assign to static
201 - wfDebug( __METHOD__ . ": Using the $algo hash algorithm.\n" );
202 - return $algo;
 200+ $this->algo = $algorithm;
 201+ wfDebug( __METHOD__ . ": Using the {$this->algo} hash algorithm.\n" );
 202+ return $this->algo;
203203 }
204204 }
205205
@@ -217,10 +217,10 @@
218218 * @return int Number of bytes the hash outputs
219219 */
220220 protected function hashLength() {
221 - if ( is_null( $hashLength ) ) {
222 - $hashLength = strlen( $this->hash( '' ) );
 221+ if ( is_null( $this->hashLength ) ) {
 222+ $this->hashLength = strlen( $this->hash( '' ) );
223223 }
224 - return $hashLength;
 224+ return $this->hashLength;
225225 }
226226
227227 /**
Index: branches/REL1_19/phase3/includes/CryptRand.php
@@ -187,8 +187,8 @@
188188 * @return String A hash algorithm
189189 */
190190 protected function hashAlgo() {
191 - if ( !is_null( $algo ) ) {
192 - return $algo;
 191+ if ( !is_null( $this->algo ) ) {
 192+ return $this->algo;
193193 }
194194
195195 $algos = hash_algos();
@@ -196,9 +196,9 @@
197197
198198 foreach ( $preference as $algorithm ) {
199199 if ( in_array( $algorithm, $algos ) ) {
200 - $algo = $algorithm; # assign to static
201 - wfDebug( __METHOD__ . ": Using the $algo hash algorithm.\n" );
202 - return $algo;
 200+ $this->algo = $algorithm;
 201+ wfDebug( __METHOD__ . ": Using the {$this->algo} hash algorithm.\n" );
 202+ return $this->algo;
203203 }
204204 }
205205
@@ -217,10 +217,10 @@
218218 * @return int Number of bytes the hash outputs
219219 */
220220 protected function hashLength() {
221 - if ( is_null( $hashLength ) ) {
222 - $hashLength = strlen( $this->hash( '' ) );
 221+ if ( is_null( $this->hashLength ) ) {
 222+ $this->hashLength = strlen( $this->hash( '' ) );
223223 }
224 - return $hashLength;
 224+ return $this->hashLength;
225225 }
226226
227227 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r114233Commit the cryptrand project worked on in git:...dantman05:17, 20 March 2012
r114272Followup r114270 (essentially reverts it), and r114233, use class member vari...reedy14:21, 20 March 2012

Status & tagging log