#39027 [Opn->Csd]: Modulus by 0 gives no warning, while division does
| From: | tony2001@php.net | Date: | Tue, 03 Oct 2006 17:54:59 +0000 |
| Subject: | #39027 [Opn->Csd]: Modulus by 0 gives no warning, while division does | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103046@lists.php.net to get a copy of this message | ||
ID: 39027
Updated by: tony2001@php.net
Reported By: ludicruz at yahoo dot com
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: linux 26.17
PHP Version: 5.1.6
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-10-03 17:06:42] ludicruz at yahoo dot com
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 this bug report at http://bugs.php.net/?id=39027&edit=1