Edit report at http://bugs.php.net/bug.php?id=52566&edit=1

 ID:                 52566
 Updated by:         ahar...@php.net
 Reported by:        elicon31 at hotmail dot com
 Summary:            Division by zero when using % operator.
-Status:             Open
+Status:             Bogus
 Type:               Bug
-Package:            *Regular Expressions
+Package:            Scripting Engine problem
 Operating System:   Windows Xp SP3
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2010-08-09 01:16:40] elicon31 at hotmail 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

Reply via email to