[php-src] Issue #12576: No exception on `mysqli::rollback` when transaction is no longer active
| From: | mvorisek | Date: | Tue, 31 Oct 2023 01:02:30 +0000 |
| Subject: | [php-src] Issue #12576: No exception on `mysqli::rollback` when transaction is no longer active | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245694@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12576
Author: mvorisek
### Description
Repro steps:
1. have an open mysqli connection
2. start transaction using
mysqli::begin_transaction
3. run some query like analyze table xx, this is "administrative statement"
[1] which implicit autocommit
4. rollback transaction using mysqli::rollback and notice no exception is thrown
Since PHP 8.0, PDO checks if a transaction is active and throws an exception:
PDOException: There is no active transaction
mysqli must throw the same exception as well.
[1] docs https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html
and repro: https://dbfiddle.uk/GalZau4E
### PHP Version
7.4 - master
### Operating System
any