Bug #63244 [Opn->Csd]: PDO fetch is inconsistent with MySQL's bit column

From: Date: Sat, 27 Apr 2013 16:38:55 +0000
Subject: Bug #63244 [Opn->Csd]: PDO fetch is inconsistent with MySQL's bit column
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9764@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63244&edit=1 ID: 63244 Updated by: vrana@php.net Reported by: juzna dot cz at gmail dot com Summary: PDO fetch is inconsistent with MySQL's bit column -Status: Open +Status: Closed Type: Bug Package: Documentation problem Operating System: Ubuntu PHP Version: 5.3.17 -Assigned To: +Assigned To: vrana Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2013-04-27 16:37:44] 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:35:19] vrana@php.net It's too late to fix this on the PHP level. Let me at least document it. ------------------------------------------------------------------------ [2012-10-08 23:03:12] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63244&edit=1

« previous php.doc.bugs (#9764) next »