Skip to content

Commit

Permalink
Merge tag '2.12.0' into oracle122
Browse files Browse the repository at this point in the history
Release [2.12.0](https://github.com/doctrine/dbal/milestone/82)

2.12.0
======

- Total issues resolved: **1**
- Total pull requests resolved: **7**
- Total contributors: **5**

Documentation,Static Analysis
-----------------------------

 - [4376: Configuration should not be internal](doctrine#4376) thanks to @BenMorel

CI
--

 - [4374: Reduce number of build jobs](doctrine#4374) thanks to @greg0ire
 - [4365: Fail on extension / tool installation failure](doctrine#4365) thanks to @greg0ire

Bug,Static Analysis
-------------------

 - [4373: Psalm fails on release commits](doctrine#4373) thanks to @morozov

Documentation,Error Handling
----------------------------

 - [4362: Adds exception thrown by execute() method](doctrine#4362) thanks to @toby-griffiths

CI,PHP
------

 - [4361: Test all extensions with PHP8](doctrine#4361) thanks to @greg0ire

PHP
---

 - [4347: &doctrine#91;2.12&doctrine#93; PHP 8 compatibility](doctrine#4347) thanks to @derrabus

# gpg: Signature made Thu Oct 22 20:29:24 2020
# gpg:                using DSA key 1BEDEE0A820BC30D858F9F0C2C3A645671828132
# gpg: Can't check signature: No public key
  • Loading branch information
rgrellmann committed Mar 7, 2021
2 parents 662e367 + c6d37b4 commit 11b6fe8
Show file tree
Hide file tree
Showing 15 changed files with 299 additions and 97 deletions.
38 changes: 28 additions & 10 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -13,6 +13,9 @@ on:
schedule:
- cron: "42 3 * * *"

env:
fail-fast: true

jobs:
phpunit-smoke-check:
name: "PHPUnit with SQLite"
Expand All @@ -23,6 +26,7 @@ jobs:
php-version:
- "7.3"
- "7.4"
- "8.0"
deps:
- "fixed"
include:
Expand Down Expand Up @@ -75,6 +79,7 @@ jobs:
matrix:
php-version:
- "7.4"
- "8.0"

services:
oracle:
Expand Down Expand Up @@ -124,6 +129,7 @@ jobs:
matrix:
php-version:
- "7.4"
- "8.0"

services:
oracle:
Expand Down Expand Up @@ -175,14 +181,11 @@ jobs:
- "7.4"
postgres-version:
- "9.2"
- "9.3"
- "9.4"
- "9.5"
- "9.6"
- "10"
- "11"
- "12"
- "13"
include:
- php-version: "8.0"
postgres-version: "13"

services:
postgres:
Expand Down Expand Up @@ -239,14 +242,18 @@ jobs:
- "7.4"
mariadb-version:
- "10.0"
- "10.1"
- "10.2"
- "10.3"
- "10.4"
- "10.5"
extension:
- "mysqli"
- "pdo_mysql"
include:
- php-version: "8.0"
mariadb-version: "10.5"
extension: "mysqli"
- php-version: "8.0"
mariadb-version: "10.5"
extension: "pdo_mysql"

services:
mariadb:
Expand Down Expand Up @@ -332,6 +339,16 @@ jobs:
php-version: "7.4"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.0"
mysql-version: "8.0"
extension: "mysqli"
custom-entrypoint: >-
--entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
- php-version: "8.0"
mysql-version: "8.0"
extension: "pdo_mysql"
custom-entrypoint: >-
--entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
services:
mysql:
Expand Down Expand Up @@ -393,6 +410,7 @@ jobs:
php-version:
- "7.3"
- "7.4"
- "8.0"
extension:
- "sqlsrv"
- "pdo_sqlsrv"
Expand Down Expand Up @@ -433,7 +451,7 @@ jobs:
coverage: "pcov"
ini-values: "zend.assertions=1"
tools: "pecl"
extensions: "${{ matrix.extension }}-5.7.0preview"
extensions: "${{ matrix.extension }}-5.9.0preview1"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
Expand Down
15 changes: 15 additions & 0 deletions UPGRADE.md
@@ -1,3 +1,18 @@
# Upgrade to 2.12

## PDO signature changes with php 8

In php 8.0, the method signatures of two PDO classes which are extended by DBAL have changed. This affects the following classes:

* `Doctrine\DBAL\Driver\PDOConnection`
* `Doctrine\DBAL\Driver\PDOStatement`

Code that extends either of the classes needs to be adjusted in order to function properly on php 8. The updated method signatures are:

* `PDOConnection::query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs)`
* `PDOStatement::setFetchMode($mode, ...$args)`
* `PDOStatement::fetchAll($mode = null, ...$args)`

# Upgrade to 2.11

## Deprecated `Abstraction\Result`
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -32,7 +32,7 @@
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"}
],
"require": {
"php": "^7.3",
"php": "^7.3 || ^8",
"ext-pdo": "*",
"doctrine/cache": "^1.0",
"doctrine/event-manager": "^1.0"
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Configuration.php
Expand Up @@ -11,8 +11,8 @@
/**
* Configuration container for the Doctrine DBAL.
*
* @internal When adding a new configuration option just write a getter/setter
* pair and add the option to the _attributes array with a proper default value.
* Internal note: When adding a new configuration option just write a getter/setter
* pair and add the option to the _attributes array with a proper default value.
*/
class Configuration
{
Expand Down
38 changes: 18 additions & 20 deletions lib/Doctrine/DBAL/Driver/PDOConnection.php
Expand Up @@ -11,7 +11,6 @@
use PDOStatement;

use function assert;
use function func_get_args;

/**
* PDO implementation of the Connection interface.
Expand All @@ -21,6 +20,8 @@
*/
class PDOConnection extends PDO implements ConnectionInterface, ServerInfoAwareConnection
{
use PDOQueryImplementation;

/**
* @internal The connection can be only instantiated by its driver.
*
Expand Down Expand Up @@ -83,25 +84,6 @@ public function prepare($sql, $driverOptions = [])
}
}

/**
* {@inheritdoc}
*
* @return PDOStatement
*/
public function query()
{
$args = func_get_args();

try {
$stmt = parent::query(...$args);
assert($stmt instanceof PDOStatement);

return $stmt;
} catch (PDOException $exception) {
throw Exception::new($exception);
}
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -133,4 +115,20 @@ public function requiresQueryForServerVersion()
{
return false;
}

/**
* @param mixed ...$args
*/
private function doQuery(...$args): PDOStatement
{
try {
$stmt = parent::query(...$args);
} catch (PDOException $exception) {
throw Exception::new($exception);
}

assert($stmt instanceof PDOStatement);

return $stmt;
}
}
39 changes: 39 additions & 0 deletions lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php
@@ -0,0 +1,39 @@
<?php

namespace Doctrine\DBAL\Driver;

use PDOStatement;

use function func_get_args;

use const PHP_VERSION_ID;

if (PHP_VERSION_ID >= 80000) {
/**
* @internal
*/
trait PDOQueryImplementation
{
/**
* @return PDOStatement
*/
public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs)
{
return $this->doQuery($query, $fetchMode, ...$fetchModeArgs);
}
}
} else {
/**
* @internal
*/
trait PDOQueryImplementation
{
/**
* @return PDOStatement
*/
public function query()
{
return $this->doQuery(...func_get_args());
}
}
}

0 comments on commit 11b6fe8

Please sign in to comment.