r71712 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71711‎ | r71712 | r71713 >
Date:17:17, 26 August 2010
Author:yaron
Status:ok
Tags:
Comment:
Fixed handling for maximum and minimum numbers - values of '0' could have led to incorrect results
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Math/SRF_Math.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Math/SRF_Math.php
@@ -71,11 +71,13 @@
7272 if ( $this->mFormat == 'sum' || $this->mFormat == 'average' ) {
7373 $sum += $num;
7474 } elseif ( $this->mFormat == 'min' ) {
75 - if ( $min == '' || $num < $min )
 75+ if ( $min === '' || $num < $min ) {
7676 $min = $num;
 77+ }
7778 } elseif ( $this->mFormat == 'max' ) {
78 - if ( $max == '' || $num > $max )
 79+ if ( $max === '' || $num > $max ) {
7980 $max = $num;
 81+ }
8082 }
8183 }
8284 }

Status & tagging log