xref: /PHP-8.4/ext/pdo_pgsql/tests/gh16314.phpt (revision a5f13782)
1--TEST--
2GH-16314 "Pdo\Pgsql object is uninitialized" when opening a persistent connection
3--EXTENSIONS--
4pdo_pgsql
5--SKIPIF--
6<?php
7require __DIR__ . '/config.inc';
8require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
9PDOTest::skip();
10?>
11--FILE--
12<?php
13putenv('PDOTEST_ATTR='.serialize([PDO::ATTR_PERSISTENT => true]));
14
15require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
16
17$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt', Pdo\Pgsql::class, false);
18var_dump($pdo->query('SELECT 1;')->fetchAll());
19
20$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt', Pdo\Pgsql::class, true);
21var_dump($pdo->query('SELECT 1;')->fetchAll());
22
23$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt', Pdo::class, false);
24var_dump($pdo->query('SELECT 1;')->fetchAll());
25
26$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt', Pdo::class, true);
27var_dump($pdo->query('SELECT 1;')->fetchAll());
28?>
29--EXPECT--
30array(1) {
31  [0]=>
32  array(2) {
33    ["?column?"]=>
34    string(1) "1"
35    [0]=>
36    string(1) "1"
37  }
38}
39array(1) {
40  [0]=>
41  array(2) {
42    ["?column?"]=>
43    string(1) "1"
44    [0]=>
45    string(1) "1"
46  }
47}
48array(1) {
49  [0]=>
50  array(2) {
51    ["?column?"]=>
52    string(1) "1"
53    [0]=>
54    string(1) "1"
55  }
56}
57array(1) {
58  [0]=>
59  array(2) {
60    ["?column?"]=>
61    string(1) "1"
62    [0]=>
63    string(1) "1"
64  }
65}
66