bug67462.phpt 885 B

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