diff --git a/includes/parser/AFPData.php b/includes/parser/AFPData.php index bd79225e7..56d26921a 100644 --- a/includes/parser/AFPData.php +++ b/includes/parser/AFPData.php @@ -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 ] ); } diff --git a/tests/phpunit/AFPDataTest.php b/tests/phpunit/AFPDataTest.php index 88315da43..55a8557b5 100644 --- a/tests/phpunit/AFPDataTest.php +++ b/tests/phpunit/AFPDataTest.php @@ -117,6 +117,7 @@ class AFPDataTest extends MediaWikiTestCase { public function divideByZero() { return [ [ '1/0', 'mulRel' ], + [ '1/0.0', 'mulRel' ], ]; } }