#39027 [NEW]: Modulus by 0 gives no warning, while division does
| From: | ludicruz at yahoo dot com | Date: | Tue, 03 Oct 2006 17:06:42 +0000 |
| Subject: | #39027 [NEW]: Modulus by 0 gives no warning, while division does | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-103043@lists.php.net to get a copy of this message | ||
From: ludicruz at yahoo dot com
Operating system: linux 26.17
PHP version: 5.1.6
PHP Bug Type: *Math Functions
Bug description: Modulus by 0 gives no warning, while division does
Description:
------------
taking a modulus with 0 does not give a warning or an error rather it
returns a boolean false. dividing by 0 gives a warning. I think for
consistancies sake (since it is practically the same operation depending
on architecture) both should either give a warning or both should return
boolean false;
Reproduce code:
---------------
<?php
var_dump(1/0);
var_dump(1%0);
?>
Expected result:
----------------
Warning: Division by zero in
/srv/www/hosts/seniorcaringcall.ithinc.net/public_html/tmp.php on line 2
bool(false)
Warning: Division by zero in
/srv/www/hosts/seniorcaringcall.ithinc.net/public_html/tmp.php on line 3
bool(false)
//OR
bool(false)
bool(false)
Actual result:
--------------
Warning: Division by zero in
/srv/www/hosts/seniorcaringcall.ithinc.net/public_html/tmp.php on line 2
bool(false) bool(false)
--
Edit bug report at http://bugs.php.net/?id=39027&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39027&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39027&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39027&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39027&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39027&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39027&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39027&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39027&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39027&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39027&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39027&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39027&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39027&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39027&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39027&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39027&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39027&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39027&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39027&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39027&r=mysqlcfg