diff --git a/.travis.yml b/.travis.yml index 9063c0de251..4dcfc4e5dd8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -132,6 +132,9 @@ jobs: - stage: Test php: 7.4 env: DB=mysqli.docker IMAGE=mysql:8.0 + - stage: Test + php: 7.4 + env: DB=mysqli-tls.docker IMAGE=mysql:8.0 TLS=yes - stage: Test php: 7.4 env: DB=mariadb.docker IMAGE=mariadb:10.3 diff --git a/UPGRADE.md b/UPGRADE.md index 32f9cdddaef..db0ca34d5cd 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -343,6 +343,10 @@ Please use other database client applications for import, e.g.: # Upgrade to 2.11 +## Deprecated `Synchronizer` package + +The `Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer` interface and all its implementations are deprecated. + ## Deprecated usage of wrapper-level components as implementations of driver-level interfaces The usage of the wrapper `Connection` and `Statement` classes as implementations of the `Driver\Connection` and `Driver\Statement` interfaces is deprecated. diff --git a/ci/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml b/ci/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml index 9c4e336a343..c868af036bc 100644 --- a/ci/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml +++ b/ci/appveyor/mssql.sql2008r2sp2.sqlsrv.appveyor.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml b/ci/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml index d0f476fb026..9ee83bf7645 100644 --- a/ci/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml +++ b/ci/appveyor/mssql.sql2012sp1.sqlsrv.appveyor.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml b/ci/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml index c5a2f6d3410..994c24d26c4 100644 --- a/ci/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml +++ b/ci/appveyor/mssql.sql2017.pdo_sqlsrv.appveyor.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/appveyor/mssql.sql2017.sqlsrv.appveyor.xml b/ci/appveyor/mssql.sql2017.sqlsrv.appveyor.xml index 515a8fe1331..2442b101766 100644 --- a/ci/appveyor/mssql.sql2017.sqlsrv.appveyor.xml +++ b/ci/appveyor/mssql.sql2017.sqlsrv.appveyor.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/docker-run-mysql-or-mariadb.sh b/ci/travis/docker-run-mysql-or-mariadb.sh index a78ce4adb6e..de0e53b9fcf 100644 --- a/ci/travis/docker-run-mysql-or-mariadb.sh +++ b/ci/travis/docker-run-mysql-or-mariadb.sh @@ -40,3 +40,11 @@ while true; do ;; esac done + +if [[ "$TLS" == "yes" ]] +then + for file in "ca.pem" "client-cert.pem" "client-key.pem" + do + docker cp "rdbms:/var/lib/mysql/$file" . + done +fi diff --git a/ci/travis/ibm_db2.travis.xml b/ci/travis/ibm_db2.travis.xml index a7664b5413e..a27065e2fca 100644 --- a/ci/travis/ibm_db2.travis.xml +++ b/ci/travis/ibm_db2.travis.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/mariadb.docker.travis.xml b/ci/travis/mariadb.docker.travis.xml index 3e3b9229cd0..d080c43c80b 100644 --- a/ci/travis/mariadb.docker.travis.xml +++ b/ci/travis/mariadb.docker.travis.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/mariadb.mysqli.docker.travis.xml b/ci/travis/mariadb.mysqli.docker.travis.xml index 5c2bff918b6..dfd8ce59b2f 100644 --- a/ci/travis/mariadb.mysqli.docker.travis.xml +++ b/ci/travis/mariadb.mysqli.docker.travis.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/mysql.docker.travis.xml b/ci/travis/mysql.docker.travis.xml index 3e3b9229cd0..d080c43c80b 100644 --- a/ci/travis/mysql.docker.travis.xml +++ b/ci/travis/mysql.docker.travis.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/mysqli-tls.docker.travis.xml b/ci/travis/mysqli-tls.docker.travis.xml new file mode 100644 index 00000000000..8c5bea77879 --- /dev/null +++ b/ci/travis/mysqli-tls.docker.travis.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + ../../tests + + + + + + ../../src + + + diff --git a/ci/travis/mysqli.docker.travis.xml b/ci/travis/mysqli.docker.travis.xml index 5c2bff918b6..dfd8ce59b2f 100644 --- a/ci/travis/mysqli.docker.travis.xml +++ b/ci/travis/mysqli.docker.travis.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/pdo_sqlsrv.travis.xml b/ci/travis/pdo_sqlsrv.travis.xml index 00bf7da6b29..7254b4b9e04 100644 --- a/ci/travis/pdo_sqlsrv.travis.xml +++ b/ci/travis/pdo_sqlsrv.travis.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/pgsql.travis.xml b/ci/travis/pgsql.travis.xml index 177c7e8afd1..b6a3e573959 100644 --- a/ci/travis/pgsql.travis.xml +++ b/ci/travis/pgsql.travis.xml @@ -27,11 +27,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/sqlite.travis.xml b/ci/travis/sqlite.travis.xml index 469b6ed8847..f2473218a51 100644 --- a/ci/travis/sqlite.travis.xml +++ b/ci/travis/sqlite.travis.xml @@ -22,11 +22,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/ci/travis/sqlsrv.travis.xml b/ci/travis/sqlsrv.travis.xml index bce0cad9cdd..4217e6868f3 100644 --- a/ci/travis/sqlsrv.travis.xml +++ b/ci/travis/sqlsrv.travis.xml @@ -28,11 +28,4 @@ ../../src - - - - performance - locking_functional - - diff --git a/docs/en/reference/transactions.rst b/docs/en/reference/transactions.rst index 58ac4a0cb5d..602a403b688 100644 --- a/docs/en/reference/transactions.rst +++ b/docs/en/reference/transactions.rst @@ -50,7 +50,7 @@ constants: The default transaction isolation level of a ``Doctrine\DBAL\Connection`` is chosen by the underlying platform -but it is always at least READ\_COMMITTED. +but it is always at least ``READ_COMMITTED``. Transaction Nesting ------------------- diff --git a/src/Driver/IBMDB2/Driver.php b/src/Driver/IBMDB2/Driver.php index 2435467603a..d3d28891f6b 100644 --- a/src/Driver/IBMDB2/Driver.php +++ b/src/Driver/IBMDB2/Driver.php @@ -16,7 +16,7 @@ public function connect(array $params) isset($params['persistent']) && $params['persistent'] === true, $params['user'] ?? '', $params['password'] ?? '', - $params['driver_options'] ?? [] + $params['driverOptions'] ?? [] ); } } diff --git a/src/Driver/Mysqli/Driver.php b/src/Driver/Mysqli/Driver.php index 8339a3ecb36..6a876a4a1b9 100644 --- a/src/Driver/Mysqli/Driver.php +++ b/src/Driver/Mysqli/Driver.php @@ -31,8 +31,8 @@ public function connect(array $params) $preInitializers = $postInitializers = []; - if (isset($params['driver_options'])) { - $driverOptions = $params['driver_options']; + if (isset($params['driverOptions'])) { + $driverOptions = $params['driverOptions']; if (isset($driverOptions[Connection::OPTION_FLAGS])) { $flags = $driverOptions[Connection::OPTION_FLAGS]; @@ -89,11 +89,11 @@ private function withSecure(array $initializers, array $params): array isset($params['ssl_cipher']) ) { $initializers[] = new Secure( - $params['ssl_key'] ?? null, - $params['ssl_cert'] ?? null, - $params['ssl_ca'] ?? null, - $params['ssl_capath'] ?? null, - $params['ssl_cipher'] ?? null + $params['ssl_key'] ?? '', + $params['ssl_cert'] ?? '', + $params['ssl_ca'] ?? '', + $params['ssl_capath'] ?? '', + $params['ssl_cipher'] ?? '' ); } diff --git a/src/Driver/Mysqli/Initializer/Secure.php b/src/Driver/Mysqli/Initializer/Secure.php index c8b2a558e4c..9d6db4e0e93 100644 --- a/src/Driver/Mysqli/Initializer/Secure.php +++ b/src/Driver/Mysqli/Initializer/Secure.php @@ -9,22 +9,22 @@ final class Secure implements Initializer { - /** @var string|null */ + /** @var string */ private $key; - /** @var string|null */ + /** @var string */ private $cert; - /** @var string|null */ + /** @var string */ private $ca; - /** @var string|null */ + /** @var string */ private $capath; - /** @var string|null */ + /** @var string */ private $cipher; - public function __construct(?string $key, ?string $cert, ?string $ca, ?string $capath, ?string $cipher) + public function __construct(string $key, string $cert, string $ca, string $capath, string $cipher) { $this->key = $key; $this->cert = $cert; diff --git a/src/Driver/PDO/MySQL/Driver.php b/src/Driver/PDO/MySQL/Driver.php index 1b52fb8a3dd..c9e9b5bae0c 100644 --- a/src/Driver/PDO/MySQL/Driver.php +++ b/src/Driver/PDO/MySQL/Driver.php @@ -13,7 +13,7 @@ final class Driver extends AbstractMySQLDriver */ public function connect(array $params) { - $driverOptions = $params['driver_options'] ?? []; + $driverOptions = $params['driverOptions'] ?? []; if (! empty($params['persistent'])) { $driverOptions[PDO::ATTR_PERSISTENT] = true; diff --git a/src/Driver/PDO/OCI/Driver.php b/src/Driver/PDO/OCI/Driver.php index 71b75acaa81..1668ec70d6f 100644 --- a/src/Driver/PDO/OCI/Driver.php +++ b/src/Driver/PDO/OCI/Driver.php @@ -13,7 +13,7 @@ final class Driver extends AbstractOracleDriver */ public function connect(array $params) { - $driverOptions = $params['driver_options'] ?? []; + $driverOptions = $params['driverOptions'] ?? []; if (! empty($params['persistent'])) { $driverOptions[PDO::ATTR_PERSISTENT] = true; diff --git a/src/Driver/PDO/PgSQL/Driver.php b/src/Driver/PDO/PgSQL/Driver.php index d380fcc0b1e..06b7ed1e383 100644 --- a/src/Driver/PDO/PgSQL/Driver.php +++ b/src/Driver/PDO/PgSQL/Driver.php @@ -15,7 +15,7 @@ final class Driver extends AbstractPostgreSQLDriver */ public function connect(array $params) { - $driverOptions = $params['driver_options'] ?? []; + $driverOptions = $params['driverOptions'] ?? []; if (! empty($params['persistent'])) { $driverOptions[PDO::ATTR_PERSISTENT] = true; diff --git a/src/Driver/PDO/SQLSrv/Driver.php b/src/Driver/PDO/SQLSrv/Driver.php index 7e9c6b66f33..f5958cea4e9 100644 --- a/src/Driver/PDO/SQLSrv/Driver.php +++ b/src/Driver/PDO/SQLSrv/Driver.php @@ -20,8 +20,8 @@ public function connect(array $params) { $pdoOptions = $dsnOptions = []; - if (isset($params['driver_options'])) { - foreach ($params['driver_options'] as $option => $value) { + if (isset($params['driverOptions'])) { + foreach ($params['driverOptions'] as $option => $value) { if (is_int($option)) { $pdoOptions[$option] = $value; } else { diff --git a/src/Driver/PDO/SQLite/Driver.php b/src/Driver/PDO/SQLite/Driver.php index a9fad42fc87..b276436543c 100644 --- a/src/Driver/PDO/SQLite/Driver.php +++ b/src/Driver/PDO/SQLite/Driver.php @@ -22,7 +22,7 @@ final class Driver extends AbstractSQLiteDriver */ public function connect(array $params) { - $driverOptions = $params['driver_options'] ?? []; + $driverOptions = $params['driverOptions'] ?? []; if (isset($driverOptions['userDefinedFunctions'])) { $this->_userDefinedFunctions = array_merge( diff --git a/src/Driver/SQLSrv/Driver.php b/src/Driver/SQLSrv/Driver.php index e2f74e864ae..ad86bd0544b 100644 --- a/src/Driver/SQLSrv/Driver.php +++ b/src/Driver/SQLSrv/Driver.php @@ -27,7 +27,7 @@ public function connect(array $params) throw PortWithoutHost::new(); } - $driverOptions = $params['driver_options'] ?? []; + $driverOptions = $params['driverOptions'] ?? []; if (isset($params['dbname'])) { $driverOptions['Database'] = $params['dbname']; diff --git a/src/Schema/Synchronizer/AbstractSchemaSynchronizer.php b/src/Schema/Synchronizer/AbstractSchemaSynchronizer.php index 9f5ccbfb78e..93d34e14c86 100644 --- a/src/Schema/Synchronizer/AbstractSchemaSynchronizer.php +++ b/src/Schema/Synchronizer/AbstractSchemaSynchronizer.php @@ -8,6 +8,8 @@ /** * Abstract schema synchronizer with methods for executing batches of SQL. + * + * @deprecated */ abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer { diff --git a/src/Schema/Synchronizer/SchemaSynchronizer.php b/src/Schema/Synchronizer/SchemaSynchronizer.php index 3e7beea7508..a10d3b7f327 100644 --- a/src/Schema/Synchronizer/SchemaSynchronizer.php +++ b/src/Schema/Synchronizer/SchemaSynchronizer.php @@ -7,6 +7,8 @@ /** * The synchronizer knows how to synchronize a schema with the configured * database. + * + * @deprecated */ interface SchemaSynchronizer { diff --git a/src/Schema/Synchronizer/SingleDatabaseSynchronizer.php b/src/Schema/Synchronizer/SingleDatabaseSynchronizer.php index 43c0fc6a544..62a58577780 100644 --- a/src/Schema/Synchronizer/SingleDatabaseSynchronizer.php +++ b/src/Schema/Synchronizer/SingleDatabaseSynchronizer.php @@ -12,6 +12,8 @@ /** * Schema Synchronizer for Default DBAL Connection. + * + * @deprecated */ class SingleDatabaseSynchronizer extends AbstractSchemaSynchronizer { diff --git a/tests/Driver/PDO/PgSQL/DriverTest.php b/tests/Driver/PDO/PgSQL/DriverTest.php index a86cbb24db4..50e9fc08696 100644 --- a/tests/Driver/PDO/PgSQL/DriverTest.php +++ b/tests/Driver/PDO/PgSQL/DriverTest.php @@ -71,7 +71,7 @@ private function connect(array $driverOptions): Connection return $this->createDriver()->connect( array_merge( TestUtil::getConnectionParams(), - ['driver_options' => $driverOptions] + ['driverOptions' => $driverOptions] ) ); } diff --git a/tests/Functional/Driver/Mysqli/ConnectionTest.php b/tests/Functional/Driver/Mysqli/ConnectionTest.php index 4baa91622b8..96f36493102 100644 --- a/tests/Functional/Driver/Mysqli/ConnectionTest.php +++ b/tests/Functional/Driver/Mysqli/ConnectionTest.php @@ -61,10 +61,18 @@ private function getConnection(array $driverOptions): Connection { $params = TestUtil::getConnectionParams(); + if (isset($params['driverOptions'])) { + // Currently, MySQLi driver options may be either numeric MYSQLI_* keys + // or the {@link Connection::OPTION_FLAGS} string key. + // The options should be merged using array union instead of array_merge() + // to preserve the numeric keys. + $driverOptions += $params['driverOptions']; + } + return (new Driver())->connect( array_merge( $params, - ['driver_options' => $driverOptions] + ['driverOptions' => $driverOptions] ) ); } diff --git a/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php b/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php index 46aafea22d4..8ebce646ec6 100644 --- a/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php +++ b/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php @@ -42,10 +42,16 @@ protected static function getDatabaseNameForConnectionWithoutDatabaseNameParamet */ private function getConnection(array $driverOptions): Connection { + $params = TestUtil::getConnectionParams(); + + if (isset($params['driverOptions'])) { + $driverOptions = array_merge($params['driverOptions'], $driverOptions); + } + return $this->connection->getDriver()->connect( array_merge( - TestUtil::getConnectionParams(), - ['driver_options' => $driverOptions] + $params, + ['driverOptions' => $driverOptions] ) ); } diff --git a/tests/TestUtil.php b/tests/TestUtil.php index 44f543d4468..eacbb4d13f5 100644 --- a/tests/TestUtil.php +++ b/tests/TestUtil.php @@ -15,6 +15,9 @@ use function extension_loaded; use function implode; use function is_string; +use function strlen; +use function strpos; +use function substr; use function unlink; /** @@ -187,6 +190,11 @@ private static function mapConnectionParameters(array $configuration, string $pr 'dbname', 'port', 'server', + 'ssl_key', + 'ssl_cert', + 'ssl_ca', + 'ssl_capath', + 'ssl_cipher', 'unix_socket', ] as $parameter ) { @@ -197,6 +205,14 @@ private static function mapConnectionParameters(array $configuration, string $pr $parameters[$parameter] = $configuration[$prefix . $parameter]; } + foreach ($configuration as $param => $value) { + if (strpos($param, $prefix . 'driver_option_') !== 0) { + continue; + } + + $parameters['driverOptions'][substr($param, strlen($prefix . 'driver_option_'))] = $value; + } + return $parameters; }