|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7755 bitwise and misbehaving with & 0xffffff00
Submitted: 2000-11-10 22:29 UTC Modified: 2001-05-13 05:33 UTC
From: roland at astrofoto dot org Assigned:
Status: Closed Package: Math related
PHP Version: 4.0.3pl1 OS: Linux, RedHat 7.0
Private report: No CVE-ID: None
 [2000-11-10 22:29 UTC] roland at astrofoto dot org
I have the following snippet of code

$w = ip2long("");
$x = $w & 0xffffff00;
$y = $w & (0xffffff << 8);
$z = ip2long("");
printf ("w = %s<br>", dechex($w));
printf ("x = %s<br>", dechex($x));
printf ("y = %s<br>", dechex($y));
printf ("z = %s<br>", dechex($z));

which outputs this:

w = c0a80223
x = 80000000
y = c0a80200
z = c0a80200

I can't come up with any reason why $x should be set as it is....


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-14 12:04 UTC]
Please try latest CVS version (also available from and report if it works better.

 [2000-11-23 07:41 UTC]
Still not working, possibly won't for some time - since PHP
numbers are 32-bits signed, so they don't work well as
32-bit unsigned.
 [2000-12-12 05:56 UTC]
I suspend this bug since PHP has no good solution for it in
the foreseeable future. Please use GMP functions for this.
 [2001-05-13 05:33 UTC]
This is not a bug, so closing.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 12:01:32 2024 UTC