Skip to content

Commit 17fa4d0

Browse files
authored
Merge pull request #9279 from ping-yee/9043_pg_ping()
fix: `Postgre\Connection::reconnect()` `TypeError` in `pg_ping()`
2 parents d81f4c5 + 0c9799f commit 17fa4d0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

system/Database/Postgre/Connection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ private function convertDSN()
149149
*/
150150
public function reconnect()
151151
{
152-
if (pg_ping($this->connID) === false) {
153-
$this->connID = false;
152+
if ($this->connID === false || pg_ping($this->connID) === false) {
153+
$this->close();
154+
$this->initialize();
154155
}
155156
}
156157

user_guide_src/source/changelogs/v4.5.6.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Bugs Fixed
4141

4242
- **Validation:** Fixed a bug where complex language strings were not properly handled.
4343
- **CURLRequest:** Added support for handling proxy responses using HTTP versions other than 1.1.
44+
- **Database:** Fixed a bug that caused ``Postgre\Connection::reconnect()`` method to throw an error when the connection had not yet been established.
4445

4546
See the repo's
4647
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_

0 commit comments

Comments
 (0)