php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65733 Bitset::set(0) sets all bits
Submitted: 2013-09-22 02:46 UTC Modified: 2014-10-31 11:30 UTC
From: yuri at ualberta dot ca Assigned: willfitch (profile)
Status: Closed Package: Bitset (PECL)
PHP Version: 5.4.20 OS: OS X
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: yuri at ualberta dot ca
New email:
PHP Version: OS:

 

 [2013-09-22 02:46 UTC] yuri at ualberta dot ca
Description:
------------
Calling Bitset::set(0) sets all bits in the bitset. This occurs even when calling Bitset::set(0,0).

Test script:
---------------
<?php
$bitset = new Bitset(8);
$bitset2 = new Bitset(8);
$bitset->set(0);
$bitset2->set(0,0);
echo $bitset->get(1) ? "bug\n" : "correct\n";
echo $bitset2->get(1) ? "bug\n" : "correct\n";


Expected result:
----------------
correct
correct

Actual result:
--------------
bug
bug


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-14 00:35 UTC] stas@php.net
-Assigned To: +Assigned To: willfitch
 [2014-09-25 10:22 UTC] harald dot lapp at gmail dot com
In my opinion the behaviour of BitSet::set(0) is currently just wrong. BitSet::set(0) should set the first bit only to be consistent with other calls like BitSet::set(2) which sets the third bit only. It does imo not make any sense that i have to specify the second argument just for setting the first bit only.
 [2014-09-25 10:24 UTC] harald dot lapp at gmail dot com
Sorry, i pressed "submit" to early. I've added an other pull-request (pecl-numbers-bitset/7) which fixes this behaviour.
 [2014-10-31 11:30 UTC] willfitch@php.net
-Status: Assigned +Status: Closed
 [2014-10-31 11:30 UTC] willfitch@php.net
Issue resolved
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 08:01:28 2024 UTC