r46187 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46186‎ | r46187 | r46188 >
Date:05:54, 25 January 2009
Author:werdna
Status:deferred
Tags:
Comment:
Explicit detection for division by zero.
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.parser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php
@@ -220,6 +220,10 @@
221221 $b = $b->toInt();
222222 }
223223
 224+ if ($op != '*' && $b == 0) {
 225+ throw new AFPException( "Illegal attempt to divide $a by 0." );
 226+ }
 227+
224228 $data = null;
225229 if( $op == '*' )
226230 $data = $a * $b;

Status & tagging log