Commit graph

3 commits

Author SHA1 Message Date
Brad Jorsch 0fb7807e9a (bug 43451) Restore old behavior of 'mod', add 'fmod'
In trying to fix bug 35866, I32c9eca6 changed the behavior of 'mod' to
no longer cast its arguments to integers, which conventiently also
solved bug 6068. However, this also broke many existing uses that
depended on that casting.

This change reverts 'mod' to its old behavior while still solving bug
35866, and at the same time adds a new 'fmod' operator with the new
behavior to keep bug 6068 fixed as well.

Change-Id: I6114c6e769119e6ced61b3b55b6f70b03b5b1ebe
2012-12-28 16:27:23 -05:00
Reedy 1a96b47d94 (Bug 35866) ParserFunctions: Division by zero in Expr.php
The PHP modulo operator ('%') casts its operands to ints, causing
floating point values 0 < $right < 1 to raise a divide-by-zero error.
Explicitly casting both operands to float and using fnmod() resolves the
issue. This change also tidies up the check for zero values and adds
tests.

Change-Id: I32c9eca6552e4fec248eb4fa6419faa39c10df3b
2012-12-11 03:21:58 -08:00
Reedy 57a6ec2942 Bug 42809 - Replace testExpr with a PHPUnit test
Change-Id: I338af01b50684b5849ca198eac536eacdc916ec6
2012-12-07 18:34:58 +01:00