xref: /PHP-8.2/ext/pdo_pgsql/tests/gh7723.phpt (revision 218a93b8)
1--TEST--
2GitHub #7723 (Fix error message allocation of PDO PgSQL)
3--EXTENSIONS--
4pdo
5pdo_pgsql
6--SKIPIF--
7<?php
8require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
9require __DIR__ . '/config.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
15require __DIR__ . '/config.inc';
16$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
17$db->setAttribute(PDO::ATTR_PERSISTENT, true);
18$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
19$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
20
21$st = $db->prepare('select 1');
22for ($i = 0; ++$i <= 2;) {
23    try {
24        $st->bindValue(':invalid', $i);
25    } catch (PDOException $e) {
26        echo $e->getMessage() . "\n";
27    }
28}
29?>
30--EXPECT--
31SQLSTATE[HY093]: Invalid parameter number: :invalid
32SQLSTATE[HY093]: Invalid parameter number: :invalid
33