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

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

Expected result:

Actual result:


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-14 00:35 UTC]
-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]
-Status: Assigned +Status: Closed
 [2014-10-31 11:30 UTC]
Issue resolved
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 21 13:01:24 2023 UTC