Bug #70170 [NEW]: mysql bit column always fetches as empty string
| From: | pletnev dot rusalex at gmail dot com | Date: | Thu, 30 Jul 2015 18:50:33 +0000 |
| Subject: | Bug #70170 [NEW]: mysql bit column always fetches as empty string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-194840@lists.php.net to get a copy of this message | ||
From: pletnev dot rusalex at gmail dot com
Operating system: debian
PHP version: 5.6.11
Package: PDO MySQL
Bug Type: Bug
Bug description:mysql bit column always fetches as empty string
Description:
------------
mysql bit column when there are values b'0' and b'1' fetched by PDO as
empty strings ""
Test script:
---------------
<?php
/**
DROP TABLE IF EXISTS
bit_values CASCADE;
CREATE TABLE bit_values (
id INT(11) NOT NULL AUTO_INCREMENT,
val bit(1) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO bit_values (id, val) VALUES (1, b'0'), (2, b'1');
*/
$pdo = new PDO(
'mysql:host=localhost;dbname=dbname',
'',
''
);
$sth = $pdo->prepare("SELECT * FROM bit_values");
$sth->execute();
$r = $sth->fetchAll(PDO::FETCH_ASSOC);
echo '<pre>'; var_dump($r); echo '</pre>'; die();
Expected result:
----------------
array(2) {
[0]=>
array(2) {
["id"]=>
string(1) "1"
["val"]=>
string(1) "0"
}
[1]=>
array(2) {
["id"]=>
string(1) "2"
["val"]=>
string(1) "1"
}
}
Actual result:
--------------
array(2) {
[0]=>
array(2) {
["id"]=>
string(1) "1"
["val"]=>
string(1) ""
}
[1]=>
array(2) {
["id"]=>
string(1) "2"
["val"]=>
string(1) ""
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=70170&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70170&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70170&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70170&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70170&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70170&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70170&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70170&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70170&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70170&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70170&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70170&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70170&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70170&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70170&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70170&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70170&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70170&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70170&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70170&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70170&r=mysqlcfg