php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53102 the number 928 incorrectly packs (loses a bit)
Submitted: 2010-10-19 14:21 UTC Modified: 2010-10-19 15:37 UTC
From: sharpg8867 at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.14 OS:
Private report: No CVE-ID: None
 [2010-10-19 14:21 UTC] sharpg8867 at gmail dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-19 15:26 UTC] markskilbeck@php.net
Why is this PHP-GTK related?
 [2010-10-19 15:33 UTC] markskilbeck@php.net
Also, you should provide a test script that people can *actually* run, not leaving us to infer the steps you took to produce the issue.
 [2010-10-19 15:36 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2010-10-19 15:36 UTC] cataphract@php.net
Can't reproduce in PHP 5.2.14.

We only support the latest versions.
 [2010-10-19 15:37 UTC] cataphract@php.net
-Package: PHP-GTK related +Package: *General Issues
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 03:01:28 2024 UTC