Statements when closeCuror() is u). (Philip Hofstetter)
. Fixed bug #69362 (PDO-pgsql fails to connect if password contains a
leading single quote). (Matteo)
+ . Fixed bug #69344 (PDO PgSQL Incorrect binding numeric array with gaps).
+ (Matteo)
- SimpleXML:
. Refactored the fix for bug #66084 (simplexml_load_string() mangles empty
sizeof(Oid));
}
if (param->paramno >= 0) {
- if (param->paramno >= zend_hash_num_elements(stmt->bound_param_map)) {
- pdo_pgsql_error_stmt(stmt, PGRES_FATAL_ERROR, "HY105");
+ if (param->paramno >= zend_hash_num_elements(stmt->bound_params)) {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined" TSRMLS_CC);
return 0;
}
--- /dev/null
+--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 l$
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$pdo = PDOTest::test_factory(dirname(__FILE__) . '/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
+