-
Notifications
You must be signed in to change notification settings - Fork 374
Closed
Description
Using the pdo_sqlsrv driver, when fetching some data from a binary column using the binary encoding, it caused assertion in Linux (tested in Ubuntu 16.04 for both PHP 7.0.x and PHP 7.1.0).
This is the repro script:
$inValue1 = "zăǽβ";
$mspdo1 = new PDO("sqlsrv:Server=$server;Database=$database;TraceOn=false", $uid, $pwd);
$stmt = $mspdo1->query("CREATE TABLE [php_test_table_1] ([c1_int] int, [c2_binary] binary(15))");
$stmt = $mspdo1->prepare("INSERT INTO [php_test_table_1] (c1_int, c2_binary) VALUES (:var1, :var2)");
$stmt->setAttribute(constant('PDO::SQLSRV_ATTR_ENCODING'), PDO::SQLSRV_ENCODING_BINARY);
$stmt->bindParam(2, $inValue1);
$stmt->bindValue(1, 1);
$stmt->execute();
$stmt = $mspdo1->prepare("SELECT * FROM [php_test_table_1]");
$stmt->setAttribute(constant('PDO::SQLSRV_ATTR_ENCODING'), PDO::SQLSRV_ENCODING_BINARY);
$stmt->execute();
$row = $stmt->fetch();
$outValue1 = $row[1];
var_dump($outValue1);
Expected output:
string(15) "zăǽβ "
Actual output:
php: .../php-sdk/php-7.1.0/pdo_sqlsrv/shared/localizationimpl.cpp:43: static int cp_iconv::GetIndex(UINT): Assertion `false' failed.
Aborted (core dumped)