summaryrefslogtreecommitdiff
path: root/ext/standard/math.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-04-18 15:50:29 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-04-18 15:50:29 +0200
commita302d51695fa5a48149c042b20f38efcabdc3b7c (patch)
tree2e482be151c58f6691727fb4b66bc8af2d7de8cc /ext/standard/math.c
parent9f0f93b00f552b83bf75f52268dd05b767eb7f10 (diff)
downloadphp-git-a302d51695fa5a48149c042b20f38efcabdc3b7c.tar.gz
Better throw an exception in intdiv() for PHP_INT_MIN/-1
Diffstat (limited to 'ext/standard/math.c')
-rw-r--r--ext/standard/math.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c
index cff798c9fb..a3685c00b9 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1458,7 +1458,8 @@ PHP_FUNCTION(intdiv)
} else if (divisor == -1 && numerator == ZEND_LONG_MIN) {
/* Prevent overflow error/crash
We don't return a float here as that violates function contract */
- RETURN_LONG(0);
+ zend_throw_exception_ex(NULL, 0, "Division of PHP_INT_MIN by -1 is not an integer");
+ return;
}
RETURN_LONG(numerator/divisor);