From 8c43868805168f1c3ce8fbef71c0c327097eac98 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 27 Dec 2024 09:58:46 +0700 Subject: [PATCH] refactor: use return empty string on pg_last_error() got empty "0" --- system/Database/Postgre/Connection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index 4ce2b0763536..2dc1a7c717e9 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -461,9 +461,11 @@ protected function _enableForeignKeyChecks() */ public function error(): array { + $lastError = pg_last_error($this->connID); + return [ 'code' => '', - 'message' => pg_last_error($this->connID), + 'message' => ! in_array($lastError, ['', '0'], true) ? $lastError : '', ]; }