Bug #71306 [NEW]: DivisionByZeroError Not Throwing

From: Date: Thu, 07 Jan 2016 23:27:20 +0000
Subject: Bug #71306 [NEW]: DivisionByZeroError Not Throwing
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198506@lists.php.net to get a copy of this message
From: hungry dot rahly at gmail dot com Operating system: Fedora 22/23/24 PHP version: 7.0.2 Package: Unknown/Other Function Bug Type: Bug Bug description:DivisionByZeroError Not Throwing 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 -- Edit bug report at https://bugs.php.net/bug.php?id=71306&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71306&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71306&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71306&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71306&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71306&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71306&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71306&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71306&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71306&r=support Expected behavior: https://bugs.php.net/fix.php?id=71306&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71306&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71306&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71306&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71306&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71306&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71306&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71306&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71306&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71306&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71306&r=mysqlcfg

« previous php.bugs (#198506) next »