wp-orm icon indicating copy to clipboard operation
wp-orm copied to clipboard

[BUG]: deleteOrFail() open transaction internally and at the moment transaction is opened but it is never closed.

Open dimitriBouteille opened this issue 1 year ago • 2 comments
trafficstars

https://github.com/dimitriBouteille/wp-orm/issues/17#issuecomment-1980829026


@dimitriBouteille one more thing, deleteOrFail() open transaction internally and at the moment transaction is opened but it is never closed.

public function deleteOrFail()
{
    if (! $this->exists) {
        return false;
    }

    return $this->getConnection()->transaction(function () {
        return $this->delete();
    });
}

In the query log, I see only: "[06-Mar-2024 12:55:51 UTC] START TRANSACTION;" and that's it.

It looks like WordPress can be launched with different type of tables: InnoDB, MyISAM, etc.

InnoDB tables are transactional tables. Non-transactional tables would be e.g MyISAM.

Please check that code is working good with transactional table and non-transactional ones. If it's running with non-transactional table, it shouldn't try to create the transaction.

I think need to add a couple of unit tests.

dimitriBouteille avatar Mar 08 '24 21:03 dimitriBouteille

Seeing this same issue with updateOrFail() as well — the transaction is started but never commits.

maxrice avatar Sep 09 '24 03:09 maxrice

Hi @maxrice

I will not be able to fix the bug on the 3.x, I plan to fix this bug on the next major release: 4.0.0.

Best,

dimitriBouteille avatar Sep 09 '24 20:09 dimitriBouteille

Hi @maxrice and @mrmoric

The issue is fixed and will be available in next major version (v4). You can find more details here: https://github.com/dimitriBouteille/wp-orm/pull/94

I let you re-open the issue if there is still a bug :)

Best

dimitriBouteille avatar Oct 13 '24 21:10 dimitriBouteille