1--TEST-- 2Bug #43925 (Incorrect argument counter in prepared statements with pgsql) 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 13require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 14$dbh = PDOTest::test_factory(__DIR__ . '/common.phpt'); 15 16$dbh->query(' 17CREATE TABLE test43925 18( 19 id integer NOT NULL PRIMARY KEY 20 , root integer NOT NULL 21 , lft integer NOT NULL 22 , rgt integer NOT NULL 23);'); 24 25$dbh->query('INSERT INTO test43925 (id, root, lft, rgt) VALUES (1, 1, 1, 6), (2, 1, 2, 3), (3, 1, 4, 5);'); 26 27 28$stmt = $dbh->prepare(' 29 SELECT * 30 FROM test43925 31 WHERE (:rootId > 0 OR lft > :left OR rgt > :left) 32 AND (root = :rootId OR root = :left) 33 AND (1 > :left OR 1 < :left OR 1 = :left) 34 AND (:x > 0 OR :x < 10 OR :x > 100) 35 OR :y = 1 OR :left = 1 36'); 37 38$stmt->bindValue('left', 1, PDO::PARAM_INT); 39$stmt->bindValue('rootId', 3, PDO::PARAM_INT); 40$stmt->bindValue('x', 5, PDO::PARAM_INT); 41$stmt->bindValue('y', 50, PDO::PARAM_INT); 42 43$stmt->execute(); 44 45foreach ($stmt->fetchAll() as $row) { 46 print implode(' - ', $row); 47 print "\n"; 48} 49?> 50--CLEAN-- 51<?php 52require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 53$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); 54$db->exec("DROP TABLE IF EXISTS test43925"); 55?> 56--EXPECT-- 571 - 1 - 1 - 1 - 1 - 1 - 6 - 6 582 - 2 - 1 - 1 - 2 - 2 - 3 - 3 593 - 3 - 1 - 1 - 4 - 4 - 5 - 5 60