[php-src] Issue #9137: PDO_Firebird: begintransaction don't desactivate autocommit
| From: | danielbredasantos | Date: | Mon, 25 Jul 2022 18:30:46 +0000 |
| Subject: | [php-src] Issue #9137: PDO_Firebird: begintransaction don't desactivate autocommit | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242016@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9137
Author: danielbredasantos
### Description
The following code:
```php
<?php
const SERVER = 'localhost';
const DATABASE = 'DATABASE_TEST';
const USERNAME = 'SYSDBA';
const PASSWORD = 'masterkey';
const CONNECTION_PARAMS = array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_ERRMODE =>
PDO::ERRMODE_EXCEPTION);
try {
$connection = new PDO('firebird:dbname=' . SERVER . ':' . DATABASE, USERNAME,
PASSWORD, CONNECTION_PARAMS);
$connection->beginTransaction();
$connection->exec('INSERT INTO TEST (FIELD_1, FIELD_2, FIELD_3, FIELD_4) VALUES (1, true,
CURRENT_DATE, \'OK\')');
throw new Exception('Error', 1); // Here the data is already committed
$connection->commit();
} catch(Throwable $e) {
$connection->rollBack();
echo $e->getMessage();
}
?>
```
Resulted in this output:
```
Data commited without "commit()" execute.
```
But I expected this output instead:
```
Data rollback o enter in catch.
```
### PHP Version
PHP 8.1.2
### Operating System
Windows 11