Bug #73312 [Com]: DBlib continues to return binary data instead of stringified "uniqueidentifier"
| From: | Andrey dot Inihov at yandex dot ru | Date: | Thu, 13 Oct 2016 15:32:39 +0000 |
| Subject: | Bug #73312 [Com]: DBlib continues to return binary data instead of stringified "uniqueidentifier" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-204669@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73312&edit=1
ID: 73312
Comment by: Andrey dot Inihov at yandex dot ru
Reported by: Andrey dot Inihov at yandex dot ru
Summary: DBlib continues to return binary data instead of
stringified "uniqueidentifier"
Status: Feedback
Type: Bug
Package: PDO DBlib
Operating System: Centos 7
PHP Version: 7.0.11
Block user comment: N
Private report: N
New Comment:
Yep, it worked. Sorry for bothering you.
Bug may be closed now.
Previous Comments:
------------------------------------------------------------------------
[2016-10-13 13:26:17] adambaratz@php.net
I think you need to add this line after creating the PDO instance:
$dbh->setAttribute(\PDO::DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER, true);
The commit that introduced this feature includes a test that should illustrate how it works:
https://github.com/php/php-src/commit/a000bff2c3cbfd1d3add3ad22d12824da16479a9
------------------------------------------------------------------------
[2016-10-13 10:39:42] Andrey dot Inihov at yandex dot ru
Description:
------------
The test script (as well as any sql query intended to retrieve uniqueidentifier from database) keeps
returning binary data instead of its' stringified value.
PHP Version: 7.0.11 from webtatic
Apache: 2.4.6
Test script:
---------------
$dbh = new \PDO ("dblib:host=192.168.1.3;dbname=a3ssmDEV", "web_interface",
"X9QARIhY");
$stmt = $dbh->prepare("select UserID from a3.dat_dat_User where Login =
'example'");
$stmt->execute();
while ($row = $stmt->fetch()) {
print_r($row);
}
die;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73312&edit=1