|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-01-08 00:43 UTC] bwoebi@php.net
-Status: Open
+Status: Not a bug
[2016-01-08 00:43 UTC] bwoebi@php.net
[2016-01-08 00:49 UTC] hungry dot rahly at gmail dot com
[2016-01-09 00:24 UTC] yohgaki@php.net
-Summary: DivisionByZeroError Not Throwing
+Summary: Remove Division by zero warning
from "/" operator
-Status: Not a bug
+Status: Re-Opened
-Type: Bug
+Type: Feature/Change Request
-Package: Unknown/Other Function
+Package: Scripting Engine problem
-Operating System: Fedora 22/23/24
+Operating System: irrelevant
-PHP Version: 7.0.2
+PHP Version: irrelevant
[2016-01-09 00:24 UTC] yohgaki@php.net
[2016-03-10 13:08 UTC] axiac dot ro at gmail dot com
[2016-03-22 20:14 UTC] ajf@php.net
[2020-01-09 11:50 UTC] nikic@php.net
-Status: Re-Opened
+Status: Closed
-Assigned To:
+Assigned To: nikic
[2020-01-09 11:50 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ It doesn't seem to throw an exception for an ACTUAL division of 0 ($var1 / $var2) and still presents as a warning Test script: --------------- <?php echo PHP_VERSION."\n"; $x = 5; $y = 0; try { print "here1\n"; $z = $x % $y; print "here2 - $z\n"; } catch(Error $e) { print "here ERROR 1 ".get_class($e)."\n"; } try { print "here3\n"; $z = $x / $y; print "here4 - $z\n"; } catch(Error $e) { print "here ERROR 2 ".get_class($e)."\n"; } try { print "here5\n"; $x = intdiv((int)$x, $y); print "here6 - $z\n"; } catch(Error $e) { print "here ERROR 3 ".get_class($e). "\n"; } Expected result: ---------------- 7.0.2 here1 here ERROR 1 DivisionByZeroError here3 here ERROR 2 DivisionByZeroError here5 here ERROR 3 DivisionByZeroError Actual result: -------------- 7.0.2 here1 here ERROR 1 DivisionByZeroError here3 PHP Warning: Division by zero in test.php on line 17 here4 - INF here5 here ERROR 3 DivisionByZeroError