Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2997
ExprModulus2.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 9:19 PM
2014-11-21 21:19:19 (UTC+0)
Size
932 B
Referenced Files
None
Subscribers
None
ExprModulus2.patch
View Options
Index: Expr.php
===================================================================
--- Expr.php (revision 14818)
+++ Expr.php (working copy)
@@ -86,6 +86,7 @@
'div' => EXPR_DIVIDE
);
+ var $_bcmath_enabled;
/**
* Add expression messages to the message cache
@@ -353,7 +354,19 @@
$right = array_pop( $stack );
$left = array_pop( $stack );
if ( $right == 0 ) return 'division_by_zero';
- $stack[] = $left % $right;
+
+ // check if BCMath is enabled and cache the result
+ if ($this->_bcmath_enabled === null) {
+ $this->_bcmath_enabled = extension_loaded('bcmath');
+ }
+
+ // call BCMath if it's enabled to fix Bug 6356
+ if ($this->_bcmath_enabled) {
+ $stack[] = bcmod($left, $right);
+ } else
+ $stack[] = $left % $right;
+ }
+
break;
case EXPR_PLUS:
if ( count( $stack ) < 2 ) return 'missing_operand';
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2567
Default Alt Text
ExprModulus2.patch (932 B)
Attached To
Mode
T8356: ParserFunctions MOD result sometimes wrong
Attached
Detach File
Event Timeline
Log In to Comment