Skip to content

Commit

Permalink
Ensure closing of connection when using the ConnectionManager::execut…
Browse files Browse the repository at this point in the history
…eAndClose() method.
  • Loading branch information
freost committed Nov 24, 2023
1 parent c91ad3f commit 0323bd0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 9.1.5 <small>(2023-11-24)</small>

#### Bugfixes

* Ensure closing of connection when using the `ConnectionManager::executeAndClose()` method.

--------------------------------------------------------

### 9.1.4 <small>(2023-11-16)</small>

#### Bugfixes
Expand Down
4 changes: 2 additions & 2 deletions src/mako/Mako.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Mako
*
* @var string
*/
public const VERSION = '9.1.4';
public const VERSION = '9.1.5';

/**
* Mako major version.
Expand All @@ -38,5 +38,5 @@ class Mako
*
* @var int
*/
public const VERSION_PATCH = 4;
public const VERSION_PATCH = 5;
}
11 changes: 6 additions & 5 deletions src/mako/common/ConnectionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ public function close(?string $connection = null): void
*/
public function executeAndClose(Closure $closure, ?string $connection = null): mixed
{
$returnValue = $closure($this->getConnection($connection));

$this->close($connection);

return $returnValue;
try {
return $closure($this->getConnection($connection));
}
finally {
$this->close($connection);
}
}

/**
Expand Down

0 comments on commit 0323bd0

Please sign in to comment.