1--TEST-- 2PDO PgSQL Bug #67462 (PDO_PGSQL::beginTransaction() wrongly throws exception when not in transaction) 3--EXTENSIONS-- 4pdo 5pdo_pgsql 6--SKIPIF-- 7<?php 8require __DIR__ . '/config.inc'; 9require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 10PDOTest::skip(); 11?> 12--FILE-- 13<?php 14 15require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 16$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); 17$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); 18 19$pdo->beginTransaction(); 20 21try { 22 $pdo->query("CREATE TABLE b67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)"); 23 $pdo->query("INSERT INTO b67462 VALUES (1), (1)"); 24 25 var_dump($pdo->inTransaction()); 26 $pdo->commit(); // This should fail! 27} catch (\Exception $e) { 28 var_dump($pdo->inTransaction()); 29 var_dump($pdo->beginTransaction()); 30} 31 32?> 33--EXPECT-- 34bool(true) 35bool(false) 36bool(true) 37