[PHP-BUG] Bug #53102 [NEW]: the number 928 incorrectly packs (loses a bit)

[email protected] ("sharpg8867 at gmail dot com") Tue, 19 Oct 2010 14:21:16 +0200 (CEST)
Newsgroups php.gtk.dev
Message-ID <[email protected]>
From:             
Operating system: 
PHP version:      5.2.14
Package:          PHP-GTK related
Bug Type:         Bug
Bug description:the number 928 incorrectly packs (loses a bit)

Description:
------------
a) packing the value 928 (0x3A0) and 927 (0x39F) as unsigned long ("N")
always converts to 927 (0x39F)
 
b) masking the lower 8 bits of 0x3A0 always reads as 0x3F or 159

Note: phpinfo reports PHP Version 5.2.13

Test script:
---------------
$value = 928;
pack("N",$value) is 0x39f (927)

$value = 927;
pack("N",$value) is 0x39f (927)

$value = 928;
$v0 = $value & 0xff;
$v0 prints as 927

Expected result:
----------------
928 packs as 928.

Actual result:
--------------
928 packs as 927

Not good for computer to lose bits.

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