com php-src: Better throw an exception in intdiv() for PHP_INT_MIN/-1: ext/standard/math.c

From: Date: Sat, 18 Apr 2015 13:50:29 +0000
Subject: com php-src: Better throw an exception in intdiv() for PHP_INT_MIN/-1: ext/standard/math.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-86369@lists.php.net to get a copy of this message
Commit: a302d51695fa5a48149c042b20f38efcabdc3b7c Author: Bob Weinand <bobwei9@hotmail.com> Sat, 18 Apr 2015 15:50:29 +0200 Parents: 9f0f93b00f552b83bf75f52268dd05b767eb7f10 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a302d51695fa5a48149c042b20f38efcabdc3b7c Log: Better throw an exception in intdiv() for PHP_INT_MIN/-1 Changed paths: M ext/standard/math.c Diff: diff --git a/ext/standard/math.c b/ext/standard/math.c index cff798c..a3685c0 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);

« previous php.cvs (#86369) next »