php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63244 PDO fetch is inconsistent with MySQL's bit column
Submitted: 2012-10-08 23:03 UTC Modified: 2013-04-27 16:38 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: juzna dot cz at gmail dot com Assigned: vrana (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.17 OS: Ubuntu
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: juzna dot cz at gmail dot com
New email:
PHP Version: OS:

 

 [2012-10-08 23:03 UTC] juzna dot cz at gmail dot com
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-27 16:35 UTC] vrana@php.net
-Package: PDO related +Package: Documentation problem
 [2013-04-27 16:35 UTC] vrana@php.net
It's too late to fix this on the PHP level. Let me at least document it.
 [2013-04-27 16:37 UTC] vrana@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=330159
Log: Document mysqlnd incompatibility regarding bit data type (fix #63244)
 [2013-04-27 16:38 UTC] vrana@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: vrana
 [2013-04-27 16:38 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:08 UTC] phpdocbot@php.net
Automatic comment on behalf of vrana
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=494639283c181f572ac3f3a2343bad4edfc1316d
Log: Document mysqlnd incompatibility regarding bit data type (fix #63244)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC