Closed
Description
Laravel Version
From v10.29.0
Tested in v10.29.0 and v10.39.0, both fail
PHP Version
8.1.2
Database Driver & Version
Microsoft SQL Server 2022
Description
From Laravel/framework, v10.29.0 I am getting error Cannot roll back trans2. No transaction or savepoint of that name was found. when running code:
DB::transaction(function () use ($partner, $globalLogin, &$apiToken) {
$apiToken = ApiToken::firstOrCreate([
'agreement_number' => $globalLogin->agreement_number,
'api_user_id' => $partner->id
], [
'token' => '111111'
]);
});
Laravel/framework v10.28.0 works fine.
The error only happens if no row exist in the database for the query.
If I remove the transaction, my code generates no errors.
It is after the revival of this one:
#48637
Also failed last time this was in the code base
Steps To Reproduce
DB::transaction(function () use ($partner, $globalLogin, &$apiToken) {
$apiToken = ApiToken::firstOrCreate([
'agreement_number' => $globalLogin->agreement_number,
'api_user_id' => $partner->id
], [
'token' => '111111'
]);
});
Run code similar to this, with no rows that match.
Metadata
Metadata
Assignees
Labels
No labels