Skip to content

Commit 881b28d

Browse files
xurshudyanXurshudyan
andauthored
Fix withoutPretending method to correctly reset state after exception (#52794)
Co-authored-by: Xurshudyan <[email protected]>
1 parent fbef34c commit 881b28d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Illuminate/Database/Connection.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,11 +672,11 @@ public function withoutPretending(Closure $callback)
672672

673673
$this->pretending = false;
674674

675-
$result = $callback();
676-
677-
$this->pretending = true;
678-
679-
return $result;
675+
try {
676+
return $callback();
677+
} finally {
678+
$this->pretending = true;
679+
}
680680
}
681681

682682
/**

0 commit comments

Comments
 (0)