You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After calling PDOstatement::nextRowset(), fetching from an encrypted max column returns some garbage characters. Following is a repro script:
<?php
try {
$conn = new PDO("sqlsrv:server = $server; Database = $databaseName; ColumnEncryption = Enabled", $uid, $pwd);
$tbname = "testNVarChar";
$createSql = "CREATE TABLE $tbname
([intCol] int ENCRYPTED WITH
(ENCRYPTION_TYPE = deterministic,
ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256',
COLUMN_ENCRYPTION_KEY = AEColumnKey),
[nVarCharCol] nvarchar(max) COLLATE Latin1_General_BIN2 ENCRYPTED WITH
(ENCRYPTION_TYPE = deterministic,
ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256',
COLUMN_ENCRYPTION_KEY = AEColumnKey))";
$conn->exec($createSql);
$intData = 1;
$nvarcharData = "This is a really large string used to test certain large data types like xml data type. The length of this string is greater than 256 to correctly test a large data type. This is currently used by atleast varchar type and by xml type. The fetch tests are the primary consumer of this string to validate that fetch on large types work fine. The length of this string as counted in terms of number of characters is 417.";
$insertSql = "INSERT INTO $tbname VALUES (?, ?)";
$stmt = $conn->prepare($insertSql);
$stmt->execute(array($intData, $nvarcharData));
$selectSql = "SELECT intCol FROM $tbname; SELECT nVarCharCol FROM $tbname";
$stmt = $conn->query($selectSql);
$rowset = $stmt->fetch(PDO::FETCH_ASSOC);
var_dump($rowset);
$stmt->nextRowset();
$rowset2 = $stmt->fetch(PDO::FETCH_ASSOC);
var_dump($rowset2);
$conn->exec("DROP TABLE $tbname");
unset($stmt);
unset($conn);
} catch (PDOException $e) {
var_dump($e);
}
?>
Without column encryption, the proper data is returned. With column encryption however, the following is returned:
array(1) {
[0]=>
array(1) {
["intCol"]=>
string(1) "1"
}
}
array(1) {
[0]=>
array(1) {
["nVarCharCol"]=>
string(440) "1 is is a really large string used to test certain large data types like xml data type. The length of this string is greater tha 辘ܵ움匜 윰ᓋ쳌쳌ᐆ ă 슠刂 ű a large data type. This is currently used by atleast varchar type and by xml type. The fetch tests are the primary consumer of this string to validate that fetch on large types work fine. The length of this string as counted in terms of number of characters"
}
}
The nvarchar string returned contains some weird characters.
The text was updated successfully, but these errors were encountered:
After calling PDOstatement::nextRowset(), fetching from an encrypted max column returns some garbage characters. Following is a repro script:
Without column encryption, the proper data is returned. With column encryption however, the following is returned:
The nvarchar string returned contains some weird characters.
The text was updated successfully, but these errors were encountered: