From 007d7ac7ca6d52ba5e7a0ba7b2c582a04ddc50df Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Thu, 2 Jul 2015 01:54:08 +0200 Subject: Use DivisionByZeroError instead of exception for %/intdiv() --- ext/standard/math.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/standard/math.c') diff --git a/ext/standard/math.c b/ext/standard/math.c index 33c83626a1..cdfb486c4f 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -1467,16 +1467,16 @@ PHP_FUNCTION(intdiv) } if (divisor == 0) { - zend_throw_exception_ex(NULL, 0, "Division by zero"); + zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Division by zero"); return; } else if (divisor == -1 && numerator == ZEND_LONG_MIN) { - /* Prevent overflow error/crash + /* Prevent overflow error/crash ... really should not happen: We don't return a float here as that violates function contract */ - zend_throw_exception_ex(NULL, 0, "Division of PHP_INT_MIN by -1 is not an integer"); + zend_error(E_ERROR | E_EXCEPTION, "Division of PHP_INT_MIN by -1 is not an integer"); return; } - RETURN_LONG(numerator/divisor); + RETURN_LONG(numerator / divisor); } /* }}} */ -- cgit v1.2.1