summaryrefslogtreecommitdiff
path: root/ext/standard/math.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-04-06 14:30:05 +0300
committerDmitry Stogov <dmitry@zend.com>2015-04-06 14:30:05 +0300
commitcae0147ed3ceb55fcb1bc059b8e8ea6a36ea69a8 (patch)
tree4ca16379ac8d5cab749f07747e2599ee23a4d175 /ext/standard/math.c
parentcaf9219dea58dcc6ef6da2b3b86a1e9808363bff (diff)
downloadphp-git-cae0147ed3ceb55fcb1bc059b8e8ea6a36ea69a8.tar.gz
Fixed weird operators behavior. Division by zero now emits warning and returns +/-INF, modulo by zero and intdid() throws an exception, shifts by negative offset throw exceptions. Compile-time evaluation of division by zero is disabled.
Diffstat (limited to 'ext/standard/math.c')
-rw-r--r--ext/standard/math.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 0125ae546a..599a3689e7 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1452,8 +1452,8 @@ PHP_FUNCTION(intdiv)
}
if (divisor == 0) {
- php_error_docref(NULL, E_WARNING, "Division by zero");
- RETURN_BOOL(0);
+ zend_throw_exception_ex(NULL, 0, "Division by zero");
+ return;
} else if (divisor == -1 && numerator == ZEND_LONG_MIN) {
/* Prevent overflow error/crash
We don't return a float here as that violates function contract */