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