Bug #61863 [Opn->Nab]: bitwise operation make overflow

From: Date: Sun, 07 Jun 2015 16:28:47 +0000
Subject: Bug #61863 [Opn->Nab]: bitwise operation make overflow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193182@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61863&edit=1 ID: 61863 Updated by: cmb@php.net Reported by: admin at todayis dot kr Summary: bitwise operation make overflow -Status: Open +Status: Not a bug Type: Bug -Package: Apache2 related +Package: Scripting Engine problem Operating System: Windows/Linux PHP Version: 5.4.0 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This behavior is by design, and it's clearly documented[1]: | Shifting integers by values greater than or equal to the system | long integer width results in undefined behavior. In other | words, don't shift more than 31 bits on a 32-bit system, and | don't shift more than 63 bits on a 64-bit system. | | Use functions from the gmp extension for bitwise manipulation on | numbers beyond PHP_INT_MAX. [1] <http://php.net/manual/en/language.operators.bitwise.php> Previous Comments: ------------------------------------------------------------------------ [2012-04-27 07:04:31] admin at todayis dot kr . ------------------------------------------------------------------------ [2012-04-27 06:36:27] admin at todayis dot kr Description: ------------ if i use bitwise operation then variable type doesn't changed float or other type. stay in int Test script: --------------- $value = "abcdefg"; for($i=0,$h=0;$i <strlen($value);$i++) { $h = ($h << 10) + ord($value[$i]); echo $h."\n"; } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61863&edit=1

« previous php.bugs (#193182) next »