FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19304&edit=1

ID: 19304
Updated by: mavdude@gmail.com
Reported By: mavdude at gmail dot com
Summary: Doesn't return all values from bit fields correctly
Status: Open
Type: Bug
-Package: MDB2
+Package: MDB2_Driver_mysql
Operating System: Ubuntu
Package Version: 2.5.0b3
PHP Version: 5.3.2
Roadmap Versions:
New Comment:

-Package: MDB2
+Package: MDB2_Driver_mysql



Previous Comments:
------------------------------------------------------------------------

[2012-02-24 12:18:04] daftmav

I thought I should probably move to the mysqli driver, but that shows
even weirder results and it gets all the bits wrong.

With MDB2_Driver_mysqli 1.5.0b3 on the same 8-bit test sample, it shows
the 6th bit always on, 7th and 8th always zero, and well... everything
is wrong:

1 [ascii value: 49 ] 00110001 : one
2 [ascii value: 50 ] 00110010 : two
3 [ascii value: 52 ] 00110100 : three
4 [ascii value: 56 ] 00111000 : four
5 [ascii value: 49 ] 00110001 : five
6 [ascii value: 51 ] 00110011 : six
7 [ascii value: 54 ] 00110110 : seven
8 [ascii value: 49 ] 00110001 : eight
9 [ascii value: 51 ] 00110011 : one and two
10 [ascii value: 53 ] 00110101 : one and three
11 [ascii value: 57 ] 00111001 : one and four
12 [ascii value: 49 ] 00110001 : one and five
13 [ascii value: 51 ] 00110011 : one and six
14 [ascii value: 54 ] 00110110 : one and seven
15 [ascii value: 49 ] 00110001 : one and eight

------------------------------------------------------------------------

[2012-02-23 22:50:12] daftmav

Description:
------------
Some values from bit fields are incorrectly returned as zero (or null?).
Not sure why it's only doing this with some bits 'on', but not when
other bits are also 'on'. Makes me think it has something to do with
bits being returned as weird ascii characters from the DB and MDB2
filters or can't handle some of them?

Stable 4.2.1 does not have this issue and correctly returns all bit
values.

Tested with MDB2 2.5.0b3 and MDB2_Driver_mysql 1.5.0b3
Also tried 2.5.0b2 but it's the same. I found it because I'm moving a
site to a php5 setup and 2.4.1 has al sorts of errors with it so I tried
the beta.

Test script:
---------------
A table with some sample data included:
http://pastebin.com/ckvX78u4

Because bit values are returned like actual bits, I've added a simple
test script which shows the problem in a more readable format.

Expected result:
----------------
1 [ascii value: 1 ] 00000001 : one
2 [ascii value: 2 ] 00000010 : two
3 [ascii value: 4 ] 00000100 : three
4 [ascii value: 8 ] 00001000 : four
5 [ascii value: 16 ] 00010000 : five
6 [ascii value: 32 ] 00100000 : six
7 [ascii value: 64 ] 01000000 : seven
8 [ascii value: 128 ] 10000000 : eight
9 [ascii value: 3 ] 00000011 : one and two
10 [ascii value: 5 ] 00000101 : one and three
11 [ascii value: 9 ] 00001001 : one and four
12 [ascii value: 17 ] 00010001 : one and five
13 [ascii value: 33 ] 00100001 : one and six
14 [ascii value: 65 ] 01000001 : one and seven
15 [ascii value: 129 ] 10000001 : one and eight

Actual result:
--------------
Note: row 6 and 11 are wrong (zero):
1 [ascii value: 1 ] 00000001 : one
2 [ascii value: 2 ] 00000010 : two
3 [ascii value: 4 ] 00000100 : three
4 [ascii value: 8 ] 00001000 : four
5 [ascii value: 16 ] 00010000 : five
6 [ascii value: 0 ] 00000000 : six <<<--- zero
7 [ascii value: 64 ] 01000000 : seven
8 [ascii value: 128 ] 10000000 : eight
9 [ascii value: 3 ] 00000011 : one and two
10 [ascii value: 5 ] 00000101 : one and three
11 [ascii value: 0 ] 00000000 : one and four <<<--- zero
12 [ascii value: 17 ] 00010001 : one and five
13 [ascii value: 33 ] 00100001 : one and six
14 [ascii value: 65 ] 01000001 : one and seven
15 [ascii value: 129 ] 10000001 : one and eight

------------------------------------------------------------------------

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
grouppear-bugs @
categoriesphp
postedFeb 24, '12 at 11:16a
activeFeb 24, '12 at 11:56a
posts3
users2
websitepear.php.net

2 users in discussion

Mavdude: 2 posts Mavdude: 1 post

People

Translate

site design / logo © 2022 Grokbase