Skip to content

Bug: BaseConnection::getConnectDuration() number_format(): Passing null to parameter #5535

@jesusferm

Description

@jesusferm

PHP Version

8.1

CodeIgniter4 Version

4.1.6

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

MariaDB 10.4.22

What happened?

number_format(): Passing null to parameter #1 ($num) of type float is deprecated

SYSTEMPATH/Database/BaseConnection.php at line 933

926 * Returns the number of seconds with microseconds that it took
927 * to connect to the database.
928 *
929 * Used by the Debug Toolbar's timeline.
930 /
931 public function getConnectDuration(int $decimals = 6): string
932 {
933 return number_format($this->connectDuration, $decimals);
934 }
935
936 /
*
937 * Protect Identifiers
938 *
939 * This function is used extensively by the Query Builder class, and by
940 * a couple functions in this class.

{PHP internal code} — CodeIgniter\Debug\Exceptions->errorHandler ( arguments )

SYSTEMPATH/Database/BaseConnection.php : 933 — number_format()

SYSTEMPATH/Debug/Toolbar/Collectors/Database.php : 112 — CodeIgniter\Database\BaseConnection->getConnectDuration ()

Steps to Reproduce

I installed codeigniter 4.1.5 with composer in XAMPP 8.0.13 in this versión it's works, but I update XAMPP TO php 8.1.1, then, i update codeigniter via composer, and when setup my project, not working, directly throws this error

Expected Output

Start login view for my project, before that only pre configure the database

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugVerified issues on the current code behavior or pull requests that will fix them

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions