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