From 186b7efbb7bcb2ec65a84116690054aa275cddde Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 29 Jun 2022 10:06:11 +0900 Subject: [PATCH 1/3] fix: do not create dynamic property in BaseConnection --- system/Database/BaseConnection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 513267f26610..413c0a4726ee 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -336,7 +336,9 @@ abstract class BaseConnection implements ConnectionInterface public function __construct(array $params) { foreach ($params as $key => $value) { - $this->{$key} = $value; + if (property_exists($this, $key)) { + $this->{$key} = $value; + } } $queryClass = str_replace('Connection', 'Query', static::class); From f9deac259202b93c6dca736d624404869a2a958b Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 29 Jun 2022 10:29:10 +0900 Subject: [PATCH 2/3] fix: add properties configured by DSN --- system/Database/Postgre/Connection.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index aec24dad3a46..7b58bdb237d8 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -42,6 +42,11 @@ class Connection extends BaseConnection */ public $escapeChar = '"'; + protected $connect_timeout; + protected $options; + protected $sslmode; + protected $service; + /** * Connect to the database. * From 5477b77b9a3e50971aeaac201e274fbc9169ea46 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 29 Jun 2022 10:38:49 +0900 Subject: [PATCH 3/3] test: add missing property in MockConnection --- system/Test/Mock/MockConnection.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/system/Test/Mock/MockConnection.php b/system/Test/Mock/MockConnection.php index c9d03e7638d6..2d95b496aab8 100644 --- a/system/Test/Mock/MockConnection.php +++ b/system/Test/Mock/MockConnection.php @@ -19,6 +19,14 @@ class MockConnection extends BaseConnection { protected $returnValues = []; + + /** + * Database schema for Postgre and SQLSRV + * + * @var string + */ + protected $schema; + public $database; public $lastQuery;