summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql/tests/bug73959.phpt
blob: 7a736329165b8e819fc838ba3b103d4503a06c82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
require __DIR__ . '/config.inc';
PDOTest::skip();
?>
--FILE--
<?php
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
require __DIR__ . '/config.inc';
$db = PDOTest::test_factory(__DIR__ . '/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