From:             ben at umingo dot de
Operating system: Windows XP 32Bit
PHP version:      5.2.6
PHP Bug Type:     Output Control
Bug description:  Sign-Bit Manipulating is buggy

Description:
------------
Problem is with sign bit. 
If i have 0x81234567 then first bit is set to 1 (sign bit).
I would expect that number to be negative, as all integers are signed 32
bit integers. 
If i echo that number, it is positive!
If i compute something with this number, it turns negative!

I have a standard PHP 5.2.6 Version and did not modify anything at it.



Reproduce code:
---------------
<?
//sign bit is not handled correctly

//a | a is expected to be a ...
//WORKS NOT
echo "with sign bit <br>";
echo (0x81234567 | 0x81234567); //result is negative
echo "<br>";
echo (0x81234567 );//result is positive

echo "<br>without sign bit <br>";
//WORKS
echo (0x71234567 | 0x71234567);
echo "<br>";
echo (0x71234567 );
?>

Expected result:
----------------
with sign bit 
-2128394905
-2128394905
without sign bit 
1898136935
1898136935


Actual result:
--------------
with sign bit 
-2128394905
2166572391
without sign bit 
1898136935
1898136935


-- 
Edit bug report at http://bugs.php.net/?id=45953&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45953&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45953&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45953&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45953&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45953&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45953&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45953&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45953&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45953&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45953&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45953&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45953&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45953&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45953&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45953&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45953&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45953&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45953&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45953&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45953&r=mysqlcfg

Reply via email to