No exception on `mysqli::rollback` when transaction is no longer active
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Repro steps:
- have an open mysqli connection
- start transaction using
mysqli::begin_transaction - run some query like
analyze table xx, this is "administrative statement" [1] which implicit autocommit - rollback transaction using
mysqli::rollbackand 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.
Related MariaDB tickets:
[1] docs https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html and repro: https://dbfiddle.uk/coUjimLq
PHP Version
7.4 - master
Operating System
any
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the mysqli::rollback entry point and reproduce the begin_transaction, administrative-statement, and rollback sequence described in the issue. Compare the transaction-state behavior with PHP 8's PDO exception behavior, then add coverage showing that rollback reports an exception when the transaction is no longer active.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100