]> granicus.if.org Git - php/commitdiff
Add special case for earlier versions of TDS
authorAdam Baratz <adambaratz@php.net>
Tue, 13 Sep 2016 21:01:51 +0000 (17:01 -0400)
committerAdam Baratz <adambaratz@php.net>
Tue, 13 Sep 2016 21:01:51 +0000 (17:01 -0400)
ext/pdo/tests/pdo_018.phpt

index d931a2c1c072b04bdeacfca7627736ba66f366bc..80e34532872f21f8fc4ef1bc1138137456fd2205 100644 (file)
@@ -129,9 +129,20 @@ unset($stmt);
 echo "===DATA===\n";
 $res = $db->query('SELECT test.val FROM test')->fetchAll(PDO::FETCH_COLUMN);
 
-// For Oracle map NULL to empty string so the test doesn't diff
-if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci' && $res[0] === null) {
-    $res[0] = "";
+switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
+       case 'dblib':
+               // map whitespace (from early TDS versions) to empty string so the test doesn't diff
+               if ($res[0] === ' ') {
+                       $res[0] = '';
+               }
+               break;
+
+       case 'oci':
+               // map NULL to empty string so the test doesn't diff
+               if ($res[0] === null) {
+                       $res[0] = '';
+               }
+               break;
 }
 var_dump($res);