1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 13:12:16 +02:00
Files
archived-php-src/ext
Nikita Popov 7b9519a792 Fix inconsistency in PDO transaction state
This addresses an issue introduced by #4996 and reported in
https://bugs.php.net/bug.php?id=80260.

Now that PDO::inTransaction() reports the real transaction state
of the connection, there may be a mismatch with PDOs internal
transaction state (in_tcx). This is compounded by the fact that
MySQL performs implicit commits for DDL queries.

This patch fixes the issue by making beginTransaction/commit/rollBack
work on the real transaction state provided by the driver as well
(or falling back to in_tcx if the driver does not support it).

This does mean that writing something like

    $pdo->beginTransaction();
    $pdo->exec('CREATE DATABASE ...');
    $pdo->rollBack(); // <- illegal

will now result in an error, because the CREATE DATABASE already
committed the transaction. I believe this behavior is both correct
and desired -- otherwise, there is no indication that the code did
not behave correctly and the rollBack() was effectively ignored.
However, this is also a BC break.

Closes GH-6355.
2020-10-26 17:01:18 +01:00
..
2020-10-07 14:58:43 +02:00
2020-10-26 11:06:10 +01:00
2020-10-22 14:50:52 +02:00
2020-10-26 13:15:03 +01:00
2020-10-02 11:56:16 +02:00
2020-10-09 17:02:20 +02:00
2020-10-02 14:26:39 +02:00
2020-10-22 10:34:14 +02:00
2020-10-15 10:17:55 +02:00
2020-10-07 12:26:46 +02:00
2020-10-09 15:25:23 +02:00
2020-10-24 15:36:05 +02:00
2020-09-03 15:07:03 +02:00
2020-10-26 15:40:12 +01:00
2020-10-13 15:34:12 +02:00
2020-10-14 16:58:07 +02:00
2020-10-06 09:49:40 +02:00
2020-09-30 21:07:25 +02:00
2020-09-18 14:28:32 +02:00
2020-09-18 14:28:32 +02:00
2020-10-08 17:10:52 +02:00
2020-10-08 16:32:01 +02:00
2020-10-13 10:41:35 +02:00
2020-10-22 16:05:57 +02:00
2020-10-09 10:43:35 +02:00
2020-10-08 10:28:50 +02:00
2020-10-08 10:28:50 +02:00
2020-09-29 16:17:23 +02:00