PHP 4.0 Bug #7755: bitwise and misbehaving with & 0xffffff00
| From: | roland at astrofoto dot org | Date: | Sat, 11 Nov 2000 03:29:04 +0000 |
| Subject: | PHP 4.0 Bug #7755: bitwise and misbehaving with & 0xffffff00 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37724@lists.php.net to get a copy of this message | ||
From: roland@astrofoto.org
Operating system: Linux, RedHat 7.0
PHP version: 4.0.3pl1
PHP Bug Type: Math related
Bug description: bitwise and misbehaving with & 0xffffff00
I have the following snippet of code
$w = ip2long("192.168.2.35");
$x = $w & 0xffffff00;
$y = $w & (0xffffff << 8);
$z = ip2long("192.168.2.0");
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....
--
Edit Bug report at: http://bugs.php.net/?id=7755&edit=1