Skip to content

Commit 397c606

Browse files
authored
Merge pull request #6198 from kenjis/fix-dynamic-property-in-BaseConnection
fix: BaseConnection may create dynamic property
2 parents fca8878 + 5477b77 commit 397c606

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

system/Database/BaseConnection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ abstract class BaseConnection implements ConnectionInterface
336336
public function __construct(array $params)
337337
{
338338
foreach ($params as $key => $value) {
339-
$this->{$key} = $value;
339+
if (property_exists($this, $key)) {
340+
$this->{$key} = $value;
341+
}
340342
}
341343

342344
$queryClass = str_replace('Connection', 'Query', static::class);

system/Database/Postgre/Connection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ class Connection extends BaseConnection
4242
*/
4343
public $escapeChar = '"';
4444

45+
protected $connect_timeout;
46+
protected $options;
47+
protected $sslmode;
48+
protected $service;
49+
4550
/**
4651
* Connect to the database.
4752
*

system/Test/Mock/MockConnection.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
class MockConnection extends BaseConnection
2020
{
2121
protected $returnValues = [];
22+
23+
/**
24+
* Database schema for Postgre and SQLSRV
25+
*
26+
* @var string
27+
*/
28+
protected $schema;
29+
2230
public $database;
2331
public $lastQuery;
2432

0 commit comments

Comments
 (0)