mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Restore check for dividebyzero
Follow-up of I1721a3ba532d481e3ecf35f51099c1438b6b73b2. This is the only wrong replacement: strict checking will let 5 / 0.0 pass, with unexpected results. Adding a regression test for it, too. Change-Id: I25dbe9fafa92fd9a11bd8bc6ab8e66f305b8d48e
This commit is contained in:
parent
77a0fd6c0d
commit
9144f20245
|
@ -346,7 +346,7 @@ class AFPData {
|
|||
$a = $a->toNumber();
|
||||
$b = $b->toNumber();
|
||||
|
||||
if ( $op !== '*' && $b === 0 ) {
|
||||
if ( $op !== '*' && (float)$b === 0.0 ) {
|
||||
throw new AFPUserVisibleException( 'dividebyzero', $pos, [ $a ] );
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ class AFPDataTest extends MediaWikiTestCase {
|
|||
public function divideByZero() {
|
||||
return [
|
||||
[ '1/0', 'mulRel' ],
|
||||
[ '1/0.0', 'mulRel' ],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue