Skip to content

Commit

Permalink
Merge branch '3.7.x' into variable-precision-time
Browse files Browse the repository at this point in the history
  • Loading branch information
cgknx committed Jun 27, 2023
2 parents fd3ab2e + d722992 commit 8c56f4c
Show file tree
Hide file tree
Showing 91 changed files with 1,117 additions and 513 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
/psalm-strict.xml export-ignore
/run-all.sh export-ignore
/SECURITY.md export-ignore
/static-analysis export-ignore
/tests export-ignore
/UPGRADE.md export-ignore
38 changes: 20 additions & 18 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
dependencies:
- "highest"
extension:
Expand Down Expand Up @@ -106,8 +107,8 @@ jobs:
matrix:
php-version:
- "7.4"
- "8.1"
- "8.2"
- "8.3"
oracle-version:
- "21"
include:
Expand Down Expand Up @@ -164,8 +165,8 @@ jobs:
matrix:
php-version:
- "7.4"
- "8.1"
- "8.2"
- "8.3"
oracle-version:
- "21"
include:
Expand Down Expand Up @@ -229,16 +230,16 @@ jobs:
- "pgsql"
- "pdo_pgsql"
include:
- php-version: "8.1"
- php-version: "8.2"
postgres-version: "15"
extension: "pgsql"
- php-version: "8.2"
- php-version: "8.3"
postgres-version: "15"
extension: "pgsql"
- php-version: "8.1"
- php-version: "8.2"
postgres-version: "15"
extension: "pdo_pgsql"
- php-version: "8.2"
- php-version: "8.3"
postgres-version: "15"
extension: "pdo_pgsql"

Expand Down Expand Up @@ -302,22 +303,22 @@ jobs:
- "mysqli"
- "pdo_mysql"
include:
- php-version: "8.1"
- php-version: "8.2"
mariadb-version: "10.7"
extension: "mysqli"
- php-version: "8.1"
- php-version: "8.2"
mariadb-version: "10.7"
extension: "pdo_mysql"
- php-version: "8.1"
- php-version: "8.2"
mariadb-version: "10.11"
extension: "mysqli"
- php-version: "8.1"
- php-version: "8.2"
mariadb-version: "10.11"
extension: "pdo_mysql"
- php-version: "8.2"
- php-version: "8.3"
mariadb-version: "10.11"
extension: "mysqli"
- php-version: "8.2"
- php-version: "8.3"
mariadb-version: "10.11"
extension: "pdo_mysql"

Expand Down Expand Up @@ -371,7 +372,7 @@ jobs:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
mysql-version:
- "5.7"
- "8.0"
Expand All @@ -390,20 +391,20 @@ jobs:
php-version: "7.4"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.1"
- php-version: "8.2"
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.1"
- php-version: "8.2"
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"
- php-version: "8.2"
- php-version: "8.3"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.2"
- php-version: "8.3"
mysql-version: "8.0"
extension: "pdo_mysql"

Expand Down Expand Up @@ -461,8 +462,8 @@ jobs:
matrix:
php-version:
- "7.4"
- "8.1"
- "8.2"
- "8.3"
extension:
- "sqlsrv"
- "pdo_sqlsrv"
Expand Down Expand Up @@ -529,6 +530,7 @@ jobs:
php-version:
- "7.4"
- "8.2"
- "8.3"

services:
ibm_db2:
Expand Down
6 changes: 3 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ if (! $diff->isEmpty()) {
}
```

## Deprecated not passing `$fromColumn` to the `TableDiff` constructor.
## Deprecated not passing `$fromTable` to the `TableDiff` constructor.

Not passing `$fromColumn` to the `TableDiff` constructor has been deprecated.
Not passing `$fromTable` to the `TableDiff` constructor has been deprecated.

The `TableDiff::$name` property and the `TableDiff::getName()` method have been deprecated as well. In order to obtain
the name of the table that the diff describes, use `TableDiff::getOldTable()`.
Expand Down Expand Up @@ -1002,7 +1002,7 @@ deprecated in order to provide a more consistent API.

## Deprecated `Comparator::compare($fromSchema, $toSchema)`

The usage of `Comparator::compare($fromSchema, $toSchema)` is deprecated and
The usage of `Comparator::compare($fromSchema, $toSchema)` is deprecated and
replaced by `Comparator::compareSchemas($fromSchema, $toSchema)` in order to
clarify the purpose of the method.

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
"psr/log": "^1|^2|^3"
},
"require-dev": {
"doctrine/coding-standard": "^12.0",
"doctrine/coding-standard": "12.0.0",
"fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2022.3",
"phpstan/phpstan": "1.10.9",
"phpstan/phpstan": "1.10.14",
"phpstan/phpstan-strict-rules": "^1.5",
"phpunit/phpunit": "9.6.6",
"phpunit/phpunit": "9.6.7",
"psalm/plugin-phpunit": "0.18.4",
"squizlabs/php_codesniffer": "3.7.2",
"symfony/cache": "^5.4|^6.0",
Expand Down
14 changes: 14 additions & 0 deletions docs/en/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ name.
$conn = DriverManager::getConnection($connectionParams);
You can also use the mapping table to map a DSN's scheme to a custom driver
class:

.. code-block:: php
<?php
use Doctrine\DBAL\Tools\DsnParser;
use App\DBAL\CustomDriver; // implements Doctrine\DBAL\Driver
//..
$dsnParser = new DsnParser(['custom' => CustomDriver::class]);
$connectionParams = $dsnParser
->parse('custom://user:secret@localhost/mydb');
Driver
~~~~~~

Expand Down
7 changes: 6 additions & 1 deletion docs/en/reference/data-retrieval-and-manipulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ position of the variable to bind into the ``bindValue()`` method:
$stmt->bindValue(1, $id);
$stmt->bindValue(2, $status);
$resultSet = $stmt->executeQuery();
.. note::

The numerical parameters in ``bindValue()`` start with the needle
``1``.

Named parameters have the advantage that their labels can be re-used and only need to be bound once:

Expand Down Expand Up @@ -231,7 +236,7 @@ the following very common SQL statement:
SELECT * FROM articles WHERE id IN (?)
Since you are using an ``IN`` expression you would really like to use it in the following way
(and I guess everybody has tried to do this once in his life, before realizing it doesn't work):
(and I guess everybody has tried to do this once in their life, before realizing it doesn't work):

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SQL or DQL query. For Example:
// Very wrong!
$sql = "SELECT * FROM users WHERE name = '" . $_GET['username']. "'";
An attacker could inject any value into the GET variable "username" to modify the query to his needs.
An attacker could inject any value into the GET variable "username" to modify the query to their needs.

Although DQL is a wrapper around SQL that can prevent some security implications, the previous
example is also a threat to DQL queries.
Expand Down
27 changes: 24 additions & 3 deletions docs/en/reference/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,19 @@ or ``null`` if no data is present.
could cause quite some troubles on platforms that had various
microtime precision formats.
Starting with 2.5 whenever the parsing of a date fails with
the predefined platform format, the ``date_create()``
function will be used to parse the date.
the predefined platform format, ``DateTime::__construct()``
method will be used to parse the date.

This could cause some troubles when your date format is weird
and not parsed correctly by ``date_create()``, however since
and not parsed correctly by ``DateTime::__construct()``, however since
databases are rather strict on dates there should be no problem.

.. warning::

Passing instances of ``DateTimeImmutable`` to this type is deprecated since 3.7. Use
:ref:`datetime_immutable` instead.

.. _datetime_immutable:
datetime_immutable
^^^^^^^^^^^^^^^^^^

Expand All @@ -301,6 +307,12 @@ information, you should consider using this type.
Values retrieved from the database are always converted to PHP's ``\DateTime`` object
or ``null`` if no data is present.

.. warning::

Passing instances of ``DateTimeImmutable`` to this type is deprecated since 3.7. Use
:ref:`datetimetz_immutable` instead.

.. _datetimetz_immutable:
datetimetz_immutable
^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -374,6 +386,10 @@ using deserialization or ``null`` if no data is present.
properly on vendors not supporting column comments and will fall back to
``text`` type instead.

.. warning::

This type is deprecated since 3.4.0, use :ref:`json` instead.

simple_array
^^^^^^^^^^^^

Expand Down Expand Up @@ -403,6 +419,7 @@ using comma delimited ``explode()`` or ``null`` if no data is present.
This basically means that every array item other than ``string``
will lose its type awareness.

.. _json:
json
^^^^

Expand Down Expand Up @@ -478,6 +495,10 @@ using deserialization or ``null`` if no data is present.
to ``serialize()``/``unserialize()`` and ``base64_encode()``/``base64_decode()`` PHP objects and store
them into a ``text`` field manually.

.. warning::

This type is deprecated since 3.4.0, use :ref:`json` instead.

.. _mappingMatrix:

Mapping Matrix
Expand Down
8 changes: 8 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@
<!-- ext-sqlite3 throws generic exceptions. -->
<!-- Catching \Exception is legit here, and we don't want to widen types to \Throwable. -->
<exclude-pattern>src/Driver/SQLite3/*</exclude-pattern>

<!-- Catching \Exception is legit for `\DateTime::__construct()`. -->
<exclude-pattern>src/Types/DateTimeType.php</exclude-pattern>
<exclude-pattern>src/Types/VarDateTimeType.php</exclude-pattern>
<!-- Catching \Exception is legit for `\DateTimeImmutable::__construct()`. -->
<exclude-pattern>src/Types/DateTimeImmutableType.php</exclude-pattern>
<exclude-pattern>src/Types/VarDateTimeImmutableType.php</exclude-pattern>
</rule>

<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
Expand Down Expand Up @@ -99,6 +106,7 @@
-->
<exclude-pattern>src/Driver/IBMDB2/Connection.php</exclude-pattern>
<exclude-pattern>src/Driver/Mysqli/Exception/ConnectionFailed.php</exclude-pattern>
<exclude-pattern>tests/Functional/Driver/Mysqli/ResultTest.php</exclude-pattern>
</rule>

<!-- See https://github.com/squizlabs/PHP_CodeSniffer/issues/2837 -->
Expand Down
6 changes: 3 additions & 3 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<file name="src/Types/ArrayType.php"/>
<file name="src/Types/ObjectType.php"/>
<file name="src/Types/Type.php"/>
<file name="tests/Schema/ComparatorTest.php"/>
<file name="tests/Schema/AbstractComparatorTestCase.php"/>
<!--
TODO: remove in 4.0.0
-->
Expand Down Expand Up @@ -747,8 +747,8 @@
or breaking API changes.
-->
<file name="src/Platforms/AbstractMySQLPlatform.php"/>
<file name="tests/Functional/Driver/AbstractDriverTest.php"/>
<file name="tests/Functional/Driver/AbstractDriverTestCase.php"/>

<!-- We're checking for invalid input. -->
<directory name="src/Driver/PgSQL"/>
<file name="src/Result.php"/>
Expand Down
4 changes: 4 additions & 0 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ private function getDatabasePlatformVersion()
return $this->params['serverVersion'];
}

if (isset($this->params['primary']) && isset($this->params['primary']['serverVersion'])) {
return $this->params['primary']['serverVersion'];
}

// If not connected, we need to connect now to determine the platform version.
if ($this->_conn === null) {
try {
Expand Down
1 change: 1 addition & 0 deletions src/DriverManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* persistent?: bool,
* platform?: Platforms\AbstractPlatform,
* port?: int,
* serverVersion?: string,
* url?: string,
* user?: string,
* unix_socket?: string,
Expand Down
2 changes: 1 addition & 1 deletion src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -4307,7 +4307,7 @@ public function getDefaultSchemaName()
*/
public function supportsCreateDropDatabase()
{
Deprecation::trigger(
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5513',
'%s is deprecated.',
Expand Down
Loading

0 comments on commit 8c56f4c

Please sign in to comment.