php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73312 DBlib continues to return binary data instead of stringified "uniqueidentifier"
Submitted: 2016-10-13 10:39 UTC Modified: 2016-10-13 15:55 UTC
From: Andrey dot Inihov at yandex dot ru Assigned:
Status: Not a bug Package: PDO DBlib
PHP Version: 7.0.11 OS: Centos 7
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: Andrey dot Inihov at yandex dot ru
New email:
PHP Version: OS:

 

 [2016-10-13 10:39 UTC] 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;


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-13 13:26 UTC] adambaratz@php.net
-Status: Open +Status: Feedback
 [2016-10-13 13:26 UTC] 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 15:32 UTC] Andrey dot Inihov at yandex dot ru
Yep, it worked. Sorry for bothering you. 

Bug may be closed now.
 [2016-10-13 15:55 UTC] adambaratz@php.net
-Status: Feedback +Status: Not a bug
 [2016-10-13 15:55 UTC] adambaratz@php.net
Thanks, closing!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC