Skip to content

Commit 723c55d

Browse files
committed
Restore the PDO error mode in case of an exception
1 parent 2839852 commit 723c55d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## UNRELEASED
4+
5+
🐛 **Bug fixes**
6+
7+
- The error mode of the PDO connection in `PDOEngine` could be left modified when an exception occurs
8+
39
## [0.11.4](https://github.com/brick/geo/releases/tag/0.11.4) - 2025-03-03
410

511
🐛 **Bug fixes**

src/Engine/PDOEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ protected function executeQuery(string $query, array $parameters) : array
8282
}
8383

8484
throw $e;
85+
} finally {
86+
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, $errMode);
8587
}
8688

87-
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, $errMode);
88-
8989
assert($result !== false);
9090

9191
return $result;

0 commit comments

Comments
 (0)