Skip to content

Commit

Permalink
Fix #14804 - Undefined index: ssl_* variables
Browse files Browse the repository at this point in the history
Fixes: #14804

Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Sep 22, 2019
1 parent b5b1488 commit 9a6a66b
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions libraries/classes/Dbi/DbiMysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,28 @@ public function connect(
! empty($server['ssl_ca_path']) ||
! empty($server['ssl_ciphers'])
) {
if (! isset($server['ssl_key']) || is_null($server['ssl_key'])) {

This comment has been minimized.

Copy link
@aschuch247

aschuch247 Sep 26, 2019

I was about to comment on eb52589 but then seen the commit here. :)

https://3v4l.org/f9ONn

I don't think the is_null() is required. isset() returns FALSE if either the key is not set, or if the key is set but its value is NULL - https://www.php.net/manual/en/function.isset.php.

This comment has been minimized.

Copy link
@williamdes

williamdes Sep 26, 2019

Author Member

Yes, true
I added is_null so that the person who reads the code knows null is a very bad value for ssl_set

$server['ssl_key'] = '';
}
if (! isset($server['ssl_cert']) || is_null($server['ssl_cert'])) {
$server['ssl_cert'] = '';
}
if (! isset($server['ssl_ca']) || is_null($server['ssl_ca'])) {
$server['ssl_ca'] = '';
}
if (! isset($server['ssl_ca_path']) || is_null($server['ssl_ca_path'])) {
$server['ssl_ca_path'] = '';
}
if (! isset($server['ssl_ciphers']) || is_null($server['ssl_ciphers'])) {
$server['ssl_ciphers'] = '';
}
mysqli_ssl_set(
$link,
is_null($server['ssl_key']) ? '' : $server['ssl_key'],
is_null($server['ssl_cert']) ? '' : $server['ssl_cert'],
is_null($server['ssl_ca']) ? '' : $server['ssl_ca'],
is_null($server['ssl_ca_path']) ? '' : $server['ssl_ca_path'],
is_null($server['ssl_ciphers']) ? '' : $server['ssl_ciphers']
$server['ssl_key'],
$server['ssl_cert'],
$server['ssl_ca'],
$server['ssl_ca_path'],
$server['ssl_ciphers']
);
}
/*
Expand Down

0 comments on commit 9a6a66b

Please sign in to comment.