php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17116 Bitwise & does not give expected results for positive numbers
Submitted: 2002-05-09 08:17 UTC Modified: 2002-07-01 17:39 UTC
From: lindsay dot marshall at ncl dot ac dot uk Assigned:
Status: Closed Package: Math related
PHP Version: 4.2.0 OS: redhat 7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lindsay dot marshall at ncl dot ac dot uk
New email:
PHP Version: OS:

 

 [2002-05-09 08:17 UTC] lindsay dot marshall at ncl dot ac dot uk
I have a piece of code that effectively does this :

$r->f = 8191;
$c->m = 7;

$r->f & $c->m returns 0!!

The above code works fine when tested standalone, but the equivalent code in my program generates 0. I can write ;

echo $r->status.' '.$current->mask.' '.($r->status&$current->mask);

and the output I get is

8191 7 0

If I write :

$a1=7;$a2=8191;
echo $r->status.' '.$current->mask.' '.($a1&$a2);

I get

8191 7 7

Something is getting confused somewhere!!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-09 08:27 UTC] lindsay dot marshall at ncl dot ac dot uk
I just tried the following:

$a1 = $r->status;
$a2 = $current->mask;
echo $a1.' '.$a2.' '.($a1&$a2);

And it still prints out 8191 7 0

I feel as though I am doing something really stupid here,  but cannot for the life of me see what it is.
 [2002-05-09 08:32 UTC] lindsay dot marshall at ncl dot ac dot uk
Oh, and before you say "BOGUS - see 7755"

1) I am not using negative integers
2) I think that 7755 is a serious bug and needs to be fixed properly as someone else commented.
3) It is clearly intermittent or at least depends on past history in some way.
 [2002-05-09 09:08 UTC] rasmus@php.net
1) You sure you aren't &'ing strings together?  
2) 7755 has been fixed - try it
3) Doubt that
 [2002-07-01 15:41 UTC] derick@php.net
Please reopen this report if this problem is still not fixed for you.

Derick
 [2002-07-01 17:39 UTC] sniper@php.net
Just close it..


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 12:03:34 2021 UTC