Skip to content

Commit

Permalink
Fix withoutPretending method to correctly reset state after exception (
Browse files Browse the repository at this point in the history
…#52794)

Co-authored-by: Xurshudyan <[email protected]>
  • Loading branch information
xurshudyan and Xurshudyan authored Sep 16, 2024
1 parent fbef34c commit 881b28d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,11 @@ public function withoutPretending(Closure $callback)

$this->pretending = false;

$result = $callback();

$this->pretending = true;

return $result;
try {
return $callback();
} finally {
$this->pretending = true;
}
}

/**
Expand Down

0 comments on commit 881b28d

Please sign in to comment.