mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 08:06:59 +02:00
Check if PDO SSL Attributes are set within config, and only set them in PDO Options. otherwise Mysql PDO throws errors if attribute is set and empty
This commit is contained in:
committed by
Jakub Vrana
parent
33234fef19
commit
6a5b0abbb4
@@ -238,11 +238,15 @@ if (!defined("DRIVER")) {
|
||||
$options = array(PDO::MYSQL_ATTR_LOCAL_INFILE => false);
|
||||
$ssl = $adminer->connectSsl();
|
||||
if ($ssl) {
|
||||
$options += array(
|
||||
PDO::MYSQL_ATTR_SSL_KEY => $ssl['key'],
|
||||
PDO::MYSQL_ATTR_SSL_CERT => $ssl['cert'],
|
||||
PDO::MYSQL_ATTR_SSL_CA => $ssl['ca'],
|
||||
);
|
||||
if (!empty($ssl['key'])) {
|
||||
$options[PDO::MYSQL_ATTR_SSL_KEY] = $ssl['key'];
|
||||
}
|
||||
if (!empty($ssl['cert'])) {
|
||||
$options[PDO::MYSQL_ATTR_SSL_CERT] = $ssl['cert'];
|
||||
}
|
||||
if (!empty($ssl['ca'])) {
|
||||
$options[PDO::MYSQL_ATTR_SSL_CA] = $ssl['ca'];
|
||||
}
|
||||
}
|
||||
$this->dsn(
|
||||
"mysql:charset=utf8;host=" . str_replace(":", ";unix_socket=", preg_replace('~:(\d)~', ';port=\1', $server)),
|
||||
|
Reference in New Issue
Block a user