forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbug67462.phpt
41 lines (36 loc) · 1.04 KB
/
bug67462.phpt
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--TEST--
PDO PgSQL Bug #67462 (PDO_PGSQL::beginTransaction() wrongly throws exception when not in transaction)
--EXTENSIONS--
pdo_pgsql
--SKIPIF--
<?php
require __DIR__ . '/config.inc';
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
PDOTest::skip();
?>
--FILE--
<?php
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$pdo->beginTransaction();
try {
$pdo->query("CREATE TABLE test67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)");
$pdo->query("INSERT INTO test67462 VALUES (1), (1)");
var_dump($pdo->inTransaction());
$pdo->commit(); // This should fail!
} catch (\Exception $e) {
var_dump($pdo->inTransaction());
var_dump($pdo->beginTransaction());
}
?>
--CLEAN--
<?php
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
$pdo->query("DROP TABLE IF EXISTS test67462");
?>
--EXPECT--
bool(true)
bool(false)
bool(true)