Skip to content

Throw exception when committing and no transaction is started #29505

Closed
@digilist

Description

@digilist

Description:

public function commit()
{
if ($this->transactions == 1) {
$this->getPdo()->commit();
}
$this->transactions = max(0, $this->transactions - 1);
$this->fireConnectionEvent('committed');
}

In cases where the user calls commit() more often than beginTransaction() (e.g. because beginTransaction() is removed by accident) the user will never notice.

This method should throw an exception instead, because otherwise the user will never notice (that the transaction has been committed to early or that no transaction is active at all).

@GrahamCampbell already pointed to that issue in #12382 and #14085 but was ignored...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions