diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-04-18 15:50:29 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-04-18 15:50:29 +0200 |
commit | a302d51695fa5a48149c042b20f38efcabdc3b7c (patch) | |
tree | 2e482be151c58f6691727fb4b66bc8af2d7de8cc /ext/standard/math.c | |
parent | 9f0f93b00f552b83bf75f52268dd05b767eb7f10 (diff) | |
download | php-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.c | 3 |
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); |