@@ -26,14 +26,20 @@ public function getDriverOptions(array $options): array
26
26
ConfigOptionsListConstants::KEY_MYSQL_SSL_KEY => ConfigOptionsListConstants::INPUT_KEY_DB_SSL_KEY ,
27
27
ConfigOptionsListConstants::KEY_MYSQL_SSL_CERT => ConfigOptionsListConstants::INPUT_KEY_DB_SSL_CERT ,
28
28
ConfigOptionsListConstants::KEY_MYSQL_SSL_CA => ConfigOptionsListConstants::INPUT_KEY_DB_SSL_CA ,
29
- ConfigOptionsListConstants::KEY_MYSQL_SSL_VERIFY => ConfigOptionsListConstants::INPUT_KEY_DB_SSL_VERIFY
29
+ ];
30
+ $ booleanDriverOptionKeys = [
31
+ ConfigOptionsListConstants::KEY_MYSQL_SSL_VERIFY => ConfigOptionsListConstants::INPUT_KEY_DB_SSL_VERIFY ,
30
32
];
31
33
$ driverOptions = [];
32
34
foreach ($ driverOptionKeys as $ configKey => $ driverOptionKey ) {
33
35
if ($ this ->optionExists ($ options , $ driverOptionKey )) {
34
36
$ driverOptions [$ configKey ] = $ options [$ driverOptionKey ];
35
37
}
36
38
}
39
+ foreach ($ booleanDriverOptionKeys as $ configKey => $ driverOptionKey ) {
40
+ $ driverOptions [$ configKey ] = $ this ->getBooleanValue ($ options , $ driverOptionKey );
41
+ }
42
+
37
43
return $ driverOptions ;
38
44
}
39
45
@@ -48,4 +54,18 @@ private function optionExists(array $options, string $driverOptionKey): bool
48
54
{
49
55
return $ options [$ driverOptionKey ] === false || !empty ($ options [$ driverOptionKey ]);
50
56
}
57
+
58
+ /**
59
+ * Transforms checkbox flag value into boolean.
60
+ *
61
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value
62
+ *
63
+ * @param array $options
64
+ * @param string $driverOptionKey
65
+ * @return bool
66
+ */
67
+ private function getBooleanValue (array $ options , string $ driverOptionKey ): bool
68
+ {
69
+ return isset ($ options [$ driverOptionKey ]) ? (bool )$ options [$ driverOptionKey ] : false ;
70
+ }
51
71
}
0 commit comments