test #47
authorMichael Wallner <mike@php.net>
Wed, 3 May 2023 12:17:21 +0000 (14:17 +0200)
committerMichael Wallner <mike@php.net>
Wed, 3 May 2023 12:21:36 +0000 (14:21 +0200)
tests/gh-issue047_jsonb.phpt [new file with mode: 0644]

diff --git a/tests/gh-issue047_jsonb.phpt b/tests/gh-issue047_jsonb.phpt
new file mode 100644 (file)
index 0000000..1f049d4
--- /dev/null
@@ -0,0 +1,40 @@
+--TEST--
+json conv broken since 2.2.1
+--SKIPIF--
+<?php
+include "_skipif.inc";
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+echo "Test\n";
+
+include "_setup.inc";
+
+$c = new pq\Connection(PQ_DSN);
+$c->defaultFetchType = \pq\Result::FETCH_ASSOC;
+
+$q = <<<EOF
+    SELECT '0'::jsonb UNION SELECT '"text"'::jsonb;
+EOF;
+$r = $c->exec($q);
+
+var_dump($r->fetchAll());
+?>
+===DONE===
+--EXPECT--
+Test
+array(2) {
+  [0]=>
+  array(1) {
+    ["jsonb"]=>
+    string(4) "text"
+  }
+  [1]=>
+  array(1) {
+    ["jsonb"]=>
+    int(0)
+  }
+}
+===DONE===