diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index 416d6e02f86f..2826ab1bf53c 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -149,8 +149,9 @@ private function convertDSN() */ public function reconnect() { - if (pg_ping($this->connID) === false) { - $this->connID = false; + if ($this->connID === false || pg_ping($this->connID) === false) { + $this->close(); + $this->initialize(); } } diff --git a/user_guide_src/source/changelogs/v4.5.6.rst b/user_guide_src/source/changelogs/v4.5.6.rst index 1dbaf55f2482..9490e62e4e80 100644 --- a/user_guide_src/source/changelogs/v4.5.6.rst +++ b/user_guide_src/source/changelogs/v4.5.6.rst @@ -41,6 +41,7 @@ Bugs Fixed - **Validation:** Fixed a bug where complex language strings were not properly handled. - **CURLRequest:** Added support for handling proxy responses using HTTP versions other than 1.1. +- **Database:** Fixed a bug that caused ``Postgre\Connection::reconnect()`` method to throw an error when the connection had not yet been established. See the repo's `CHANGELOG.md `_