Skip to content

Commit bcee34c

Browse files
committed
Add special case for earlier versions of TDS
1 parent 0de333b commit bcee34c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

ext/pdo/tests/pdo_018.phpt

+14-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,20 @@ unset($stmt);
129129
echo "===DATA===\n";
130130
$res = $db->query('SELECT test.val FROM test')->fetchAll(PDO::FETCH_COLUMN);
131131

132-
// For Oracle map NULL to empty string so the test doesn't diff
133-
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci' && $res[0] === null) {
134-
$res[0] = "";
132+
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
133+
case 'dblib':
134+
// map whitespace (from early TDS versions) to empty string so the test doesn't diff
135+
if ($res[0] === ' ') {
136+
$res[0] = '';
137+
}
138+
break;
139+
140+
case 'oci':
141+
// map NULL to empty string so the test doesn't diff
142+
if ($res[0] === null) {
143+
$res[0] = '';
144+
}
145+
break;
135146
}
136147
var_dump($res);
137148

0 commit comments

Comments
 (0)