summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_pgsql/tests')
-rw-r--r--ext/pdo_pgsql/tests/bug73959.phpt27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/pdo_pgsql/tests/bug73959.phpt b/ext/pdo_pgsql/tests/bug73959.phpt
new file mode 100644
index 0000000000..c04b4acd52
--- /dev/null
+++ b/ext/pdo_pgsql/tests/bug73959.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #73959 (lastInsertId fails to throw an exception)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+require dirname(__FILE__) . '/config.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+require dirname(__FILE__) . '/config.inc';
+$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+$db->setAttribute(PDO::ATTR_PERSISTENT, false);
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+$db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
+
+try {
+ $db->lastInsertId('nonexistent_seq');
+ echo "Error: No exception thrown";
+} catch (PDOException $e) {
+ echo "Success: Exception thrown";
+}
+?>
+--EXPECT--
+Success: Exception thrown