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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
12 + 12 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 18 23:01:27 2024 UTC