1--TEST-- 2PDO PgSQL Bug #70313 (PDO statement fails to throw exception) 3--SKIPIF-- 4<?php 5if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); 6require __DIR__ . '/config.inc'; 7require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 8PDOTest::skip(); 9?> 10--FILE-- 11<?php 12require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 13$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); 14$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 15 16$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); 17try { 18 $stmt = $db->prepare(");"); 19 20 $stmt->execute([1]); 21} catch (PDOException $e) { 22 echo $e->getMessage(), "\n"; 23} 24 25$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); 26try { 27 $stmt = $db->prepare(");"); 28 29 $stmt->execute([1]); 30} catch (PDOException $e) { 31 echo $e->getMessage(), "\n"; 32} 33 34?> 35--EXPECTF-- 36SQLSTATE[42601]: Syntax error: %A 37SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens 38