Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: BaseConnection::getConnectDuration() number_format(): Passing null to parameter #5536

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions system/Database/BaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ abstract class BaseConnection implements ConnectionInterface
*
* @var float
*/
protected $connectTime;
protected $connectTime = 0.0;

/**
* How long it took to establish connection.
*
* @var float
*/
protected $connectDuration;
protected $connectDuration = 0.0;

/**
* If true, no queries will actually be
Expand Down
10 changes: 10 additions & 0 deletions tests/system/Database/BaseConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ public function testStoresConnectionTimings()
$this->assertGreaterThan(0.0, $db->getConnectDuration());
}

/**
* @see https://github.com/codeigniter4/CodeIgniter4/issues/5535
*/
public function testStoresConnectionTimingsNotConnected()
{
$db = new MockConnection($this->options);

$this->assertSame('0.000000', $db->getConnectDuration());
}

public function testMagicIssetTrue()
{
$db = new MockConnection($this->options);
Expand Down