-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
PHP Version
8.2
CodeIgniter4 Version
4.3.2
CodeIgniter4 Installation Method
Composer (using codeigniter4/appstarter)
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
While following the instructions for configuring a database connection, I have configured my env file to contain the following:
database.default.DBDriver = MySQLi
database.default.encrypt.ssl_ca = C:\xampp\perl\vendor\lib\Mozilla\CA\cacert.pem
database.default.encrypt.ssl_verify = true
However, it appears these are not being respected by the actual SSL connection, as seen in Database.php. Thus, checking in vendor/codeigniter4/framework/system/Database/MySQLi/Connection.php. it appears that the entire section for checking if is_array($this->encrypt) is skipped over due to not being an array.
I have "fixed" this by adding a simple line beforehand that manually sets the encrypt values:
$this->encrypt = [
'ssl_key' => '',
'ssl_cert' => '',
'ssl_ca' => 'C:\xampp\perl\vendor\lib\Mozilla\CA\cacert.pem',
'ssl_capath' => '',
'ssl_cipher' => '',
'ssl_verify' => 'true'
];Thus continuing the checks and ensuring I can make an encrypted connection.
Steps to Reproduce
- Set any of the encryption subvalues in your .env file, or in Database.php
- Go to vendor/codeigniter4/framework/system/Database/MySQLi/Connection.php
- Within the connection function, add a simple
print_r($this->encrypt);and observe that it appears to be being interpreted as a boolean rather than a array.
Expected Output
The correct values to be passed to Database.php / Connection.php to allow for connecting to databases that enforce SSL connections.
Anything else?
No response