diff options
| author | Bob Weinand <bobwei9@hotmail.com> | 2015-07-02 01:54:08 +0200 |
|---|---|---|
| committer | Bob Weinand <bobwei9@hotmail.com> | 2015-07-02 02:20:58 +0200 |
| commit | 007d7ac7ca6d52ba5e7a0ba7b2c582a04ddc50df (patch) | |
| tree | 1a3615bd2fb103b7a0e9703fd869891613a57510 /ext/standard/math.c | |
| parent | f9724b93f6592d2f77fa9165038a0ba0db3da0c6 (diff) | |
| download | php-git-007d7ac7ca6d52ba5e7a0ba7b2c582a04ddc50df.tar.gz | |
Use DivisionByZeroError instead of exception for %/intdiv()
Diffstat (limited to 'ext/standard/math.c')
| -rw-r--r-- | ext/standard/math.c | 8 |
1 files changed, 4 insertions, 4 deletions
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); } /* }}} */ |
