Bug #52566 [Bgs]: Division by zero when using % operator.
Edit report at http://bugs.php.net/bug.php?id=52566&edit=1
ID: 52566
User updated by: eagls at yahoo dot com
Reported by: eagls at yahoo dot com
Summary: Division by zero when using % operator.
Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: Windows Xp SP3
PHP Version: 5.3.3
Block user comment: N
New Comment:
just testing
Previous Comments:
------------------------------------------------------------------------
[2010-08-09 11:32:12] aharvey@php.net
On a 32 bit compile of PHP, 4294967296 used in an integer context will
overflow to 0, hence PHP believes you're attempting to divide by 0,
remembering that modulus is effectively division.
Expected behaviour; closing.
------------------------------------------------------------------------
[2010-08-09 01:16:40] eagls at yahoo dot com
Description:
------------
Asume $f[1] = ""
I get a "Division by zero" error when i do this:
$overflowsimulation = (((strlen($f[1])) + 2147483648) % 4294967296);
In fact, i get it even if i do this:
$overflowsimulation = (2147483648 % 4294967296);
Thanks.
Test script:
---------------
<?php
$f = "";
$osim = (((strlen($f)) + 2147483648) % 4294967296);
echo $osim;
?>
Expected result:
----------------
0
Actual result:
--------------
Warning: Division by zero in C:\Archivos de
programa\EasyPHP-5.3.2i\www\BASICtoPHP_testfile_60661.578.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52566&edit=1
Thread (3 messages)