forked from php/php-src
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-5.5: Added PGSQL_TEST_CONNSTR env var support for ext/pgsql tests Fixed bug #67462 PDO_PGSQL::beginTransaction() wrongly throws exception when not in transaction
- Loading branch information
Showing
3 changed files
with
58 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--TEST-- | ||
PDO PgSQL Bug #67462 (PDO_PGSQL::beginTransaction() wrongly throws exception when not in transaction) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); | ||
require dirname(__FILE__) . '/config.inc'; | ||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; | ||
PDOTest::skip(); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; | ||
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); | ||
$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); | ||
|
||
$pdo->beginTransaction(); | ||
|
||
try { | ||
$pdo->query("CREATE TABLE b67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)"); | ||
$pdo->query("INSERT INTO b67462 VALUES (1), (1)"); | ||
|
||
var_dump($pdo->inTransaction()); | ||
$pdo->commit(); // This should fail! | ||
} catch (\Exception $e) { | ||
var_dump($pdo->inTransaction()); | ||
var_dump($pdo->beginTransaction()); | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
bool(true) | ||
bool(false) | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters