mirror of
https://github.com/php/php-src.git
synced 2026-04-14 11:32:11 +02:00
And thus generate error messages that match what PDO emulation would generate. This fixes the error message regression from the previous commit.
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
--TEST--
|
|
PDO PgSQL Bug #69344 (PDO PgSQL Incorrect binding numeric array with gaps)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
|
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
|