forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbug69344.phpt
45 lines (37 loc) · 1.02 KB
/
bug69344.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--TEST--
PDO PgSQL Bug #69344 (PDO PgSQL Incorrect binding numeric array with gaps)
--EXTENSIONS--
pdo
pdo_pgsql
--SKIPIF--
<?php
require __DIR__ . '/config.inc';
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
PDOTest::skip();
?>
--FILE--
<?php
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute (\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
$test = function () use ($pdo) {
$arr = [
0 => "a",
2 => "b",
];
$stmt = $pdo->prepare("SELECT (?)::text AS a, (?)::text AS b");
try {
$stmt->execute($arr);
var_dump($stmt->fetch());
} catch (\Exception $e) {
echo $e->getMessage()."\n";
}
};
$test();
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
$test();
?>
--EXPECT--
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined