From: Derick Rethans Date: Sun, 22 Feb 2004 20:02:26 +0000 (+0000) Subject: - Fixed bug #27354 (Modulus operator crashes PHP). X-Git-Tag: RELEASE_0_2_0~230 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2c9926923b6da6d3a0df935b1c950500704b2aa;p=php - Fixed bug #27354 (Modulus operator crashes PHP). --- 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;