summaryrefslogtreecommitdiff
path: root/Zend/zend_operators.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r--Zend/zend_operators.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index c83fd08e03..08eb13398c 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -836,6 +836,11 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
return FAILURE; /* modulus by zero */
}
+ if (abs(op2->value.lval) == 1) {
+ ZVAL_LONG(result, 0);
+ return SUCCESS;
+ }
+
result->type = IS_LONG;
result->value.lval = op1->value.lval % op2->value.lval;
return SUCCESS;