#30271 [NEW]: Bitwise operator returns unwanted values
From: mccohy at kyberdigi dot cz
Operating system: Linux
PHP version: 5.0.2
PHP Bug Type: Math related
Bug description: Bitwise operator returns unwanted values
Description:
------------
The bitwise operator "and" returns an unwanted value. Here is a simple
example:
Let's store value 924303769 in variable $a and value -2147483649 in
variable $ax. Now, let's count the 'bitwise and' of these two variables
($a & $ax).
PHP 5.0.2 returns zero. PHP 4.3.9 returns 924303769. I am not sure what
happens in 5.0.0 or 5.0.1, sorry.
Reproduce code:
---------------
$a=924303769;
$ax=-2147483649;
echo ($a & $ax)."\n";
Expected result:
----------------
924303769
Actual result:
--------------
0
--
Edit bug report at http://bugs.php.net/?id=30271&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30271&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30271&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30271&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30271&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30271&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30271&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30271&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30271&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30271&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30271&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30271&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30271&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30271&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30271&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30271&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30271&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30271&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30271&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30271&r=mysqlcfg
Thread (5 messages)
- mccohy at kyberdigi dot cz