From:             juzna dot cz at gmail dot com
Operating system: Ubuntu
PHP version:      5.3.17
Package:          PDO related
Bug Type:         Bug
Bug description:PDO fetch is inconsistent with MySQL's bit column

Description:
------------
Suppose MySQL database with a column of type bit(1).

Then fetching value from this column gives a binary string ("\0", "\1") in
PHP5.3 
and numeric string ("0", "1") in 5.4.

I'd expect to obtain a boolean, but numeric string would be a good enough.
But it 
must be consistent in both PHP versions.

Test script:
---------------
$res = $connection->query("SELECT * FROM bittest");
$row = $res->fetch();
dump($row);
Assert::same(0, $row->id);
Assert::same(false, $row->flag);

$row = $res->fetch();
dump($row);
Assert::same(1, $row->id);
Assert::same(true, $row->flag);


Expected result:
----------------
// 5.3.17
Nette\Database\Row(2) {
   id => 0
   flag => "\00"
}

Nette\Database\Row(2) {
   id => 1
   flag => "\01"
}


// PHP 5.4.7
Nette\Database\Row(2) {
   id => 0
   flag => "0"
}

Nette\Database\Row(2) {
   id => 1
   flag => "1"
}

Actual result:
--------------
Both PHP versions the same.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63244&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63244&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63244&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63244&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63244&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63244&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63244&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63244&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63244&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63244&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63244&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63244&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63244&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63244&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63244&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63244&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63244&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63244&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63244&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63244&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63244&r=mysqlcfg

Reply via email to