mirror of
https://github.com/php/php-src.git
synced 2026-04-28 18:53:33 +02:00
throw a warning when doing modulus by 0 (fr #39027)
This commit is contained in:
@@ -1297,6 +1297,7 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
zendi_convert_to_long(op2, op2_copy, result);
|
||||
|
||||
if (Z_LVAL_P(op2) == 0) {
|
||||
zend_error(E_WARNING, "Division by zero");
|
||||
ZVAL_BOOL(result, 0);
|
||||
return FAILURE; /* modulus by zero */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user