From 5b90d9ad705e5c576eb979fe2cec9179c23ca499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 20 Oct 2024 12:18:04 +0200 Subject: [PATCH 1/7] Inherit issue templates from the centralized repository --- .github/ISSUE_TEMPLATE/Bug.md | 33 ---------------------- .github/ISSUE_TEMPLATE/Feature_Request.md | 17 ----------- .github/ISSUE_TEMPLATE/Support_Question.md | 20 ------------- 3 files changed, 70 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/Bug.md delete mode 100644 .github/ISSUE_TEMPLATE/Feature_Request.md delete mode 100644 .github/ISSUE_TEMPLATE/Support_Question.md diff --git a/.github/ISSUE_TEMPLATE/Bug.md b/.github/ISSUE_TEMPLATE/Bug.md deleted file mode 100644 index 127743902f1..00000000000 --- a/.github/ISSUE_TEMPLATE/Bug.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: 🐞 Bug Report -about: Something is broken? 🔨 ---- - -### Bug Report - - - -| Q | A -|------------ | ------ -| Version | x.y.z - -#### Summary - - - -#### Current behaviour - - - -#### How to reproduce - - - -#### Expected behaviour - - - diff --git a/.github/ISSUE_TEMPLATE/Feature_Request.md b/.github/ISSUE_TEMPLATE/Feature_Request.md deleted file mode 100644 index 777fce18607..00000000000 --- a/.github/ISSUE_TEMPLATE/Feature_Request.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: 🎉 Feature Request -about: You have a neat idea that should be implemented? 🎩 ---- - -### Feature Request - - - -| Q | A -|------------ | ------ -| New Feature | yes -| RFC | yes/no - -#### Summary - - diff --git a/.github/ISSUE_TEMPLATE/Support_Question.md b/.github/ISSUE_TEMPLATE/Support_Question.md deleted file mode 100644 index d5bccbd15fa..00000000000 --- a/.github/ISSUE_TEMPLATE/Support_Question.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: ❓ Support Question -about: Have a problem that you can't figure out? 🤔 ---- - - - -| Q | A -|------------ | ----- -| Version | x.y.z - - - -### Support Question - - From db467f090c840671ad09eb4cec93ebd6a3836084 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Sat, 19 Oct 2024 12:12:38 +0200 Subject: [PATCH 2/7] Cover scenario `BEGIN TRANSACTION; COMMIT; BEGIN TRANSACTION; --failure` https://github.com/doctrine/dbal/pull/6545#issuecomment-2412377607 --- tests/ConnectionTest.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index 10e1ea4d77b..1b098d8eee0 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -32,6 +32,7 @@ use PHPUnit\Framework\TestCase; use Psr\Cache\CacheItemInterface; use Psr\Cache\CacheItemPoolInterface; +use RuntimeException; use stdClass; /** @requires extension pdo_mysql */ @@ -413,6 +414,35 @@ public function testCommitStartsTransactionInNoAutoCommitMode(): void self::assertTrue($conn->isTransactionActive()); } + public function testBeginTransactionFailureAfterCommitInNoAutoCommitMode(): void + { + $driverConnectionMock = $this->createMock(DriverConnection::class); + $driverConnectionMock->expects(self::exactly(2)) + ->method('beginTransaction') + ->willReturnOnConsecutiveCalls( + true, + self::throwException(new RuntimeException()), + ); + + $driver = $this->createStub(Driver::class); + $driver + ->method('connect') + ->willReturn( + $driverConnectionMock, + ); + $conn = new Connection([], $driver); + + $conn->setAutoCommit(false); + + $conn->connect(); + try { + $conn->commit(); + } catch (RuntimeException $e) { + } + + self::assertTrue($conn->isTransactionActive()); + } + /** @dataProvider resultProvider */ public function testCommitReturn(bool $expectedResult): void { From 53bde79a7486563163efabbbcc675845f495bfb7 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Tue, 22 Oct 2024 03:35:44 +0200 Subject: [PATCH 3/7] Run tests with MySQL 9.1 (#6568) --- .github/workflows/continuous-integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 56558bc7f0f..4be5b0ecc6e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -399,7 +399,7 @@ jobs: mysql-version: - "5.7" - "8.0" - - "9.0" + - "9.1" extension: - "mysqli" - "pdo_mysql" @@ -428,10 +428,10 @@ jobs: custom-entrypoint: >- --entrypoint sh mysql:8.4 -c "exec docker-entrypoint.sh mysqld --mysql-native-password=ON" - php-version: "8.4" - mysql-version: "9.0" + mysql-version: "9.1" extension: "mysqli" - php-version: "8.4" - mysql-version: "9.0" + mysql-version: "9.1" extension: "pdo_mysql" services: From 22e878dc84d7667b384b2b8916ac518f16ec4704 Mon Sep 17 00:00:00 2001 From: Claudia Schmidt <1684565+SchmidtClaudia@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:53:00 +0200 Subject: [PATCH 4/7] Fix broken links (#6572) --- docs/en/reference/configuration.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/en/reference/configuration.rst b/docs/en/reference/configuration.rst index eb236b22634..495a38a8aba 100644 --- a/docs/en/reference/configuration.rst +++ b/docs/en/reference/configuration.rst @@ -249,7 +249,7 @@ mysqli - ``ssl_ca`` (string): The path name to the certificate authority file to use for SSL encryption. - ``ssl_capath`` (string): The pathname to a directory that contains trusted SSL CA certificates in PEM format. - ``ssl_cipher`` (string): A list of allowable ciphers to use for SSL encryption. -- ``driverOptions`` Any supported flags for mysqli found on `http://www.php.net/manual/en/mysqli.real-connect.php` +- ``driverOptions`` Any supported flags for mysqli found on `www.php.net/manual/en/mysqli.real-connect.php `_ pdo_pgsql / pgsql ^^^^^^^^^^^^^^^^^ @@ -266,22 +266,22 @@ pdo_pgsql / pgsql - ``sslmode`` (string): Determines whether or with what priority a SSL TCP/IP connection will be negotiated with the server. See the list of available modes: - `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE` + `www.postgresql.org/docs/9.4/libpq-connect.html#LIBPQ-CONNECT-SSLMODE `_ - ``sslrootcert`` (string): specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. - See https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT + See `www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT `_ - ``sslcert`` (string): specifies the filename of the client SSL certificate. - See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT` + See `www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT `_ - ``sslkey`` (string): specifies the location for the secret key used for the client certificate. - See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY` + See `www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY `_ - ``sslcrl`` (string): specifies the filename of the SSL certificate revocation list (CRL). - See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL` + See `www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL `_ - ``gssencmode`` (string): Optional GSS-encrypted channel/GSSEncMode configuration. - See `https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-GSSENCMODE` + See `www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-GSSENCMODE `_ - ``application_name`` (string): Name of the application that is connecting to database. Optional. It will be displayed at ``pg_stat_activity``. @@ -316,7 +316,7 @@ pdo_oci / oci8 add the INSTANCE_NAME parameter in the connection. It is generally used to connect to an Oracle RAC server to select the name of a particular instance. - ``connectstring`` (string): Complete Easy Connect connection descriptor, - see https://docs.oracle.com/database/121/NETAG/naming.htm. When using this option, + see `docs.oracle.com/en/database/oracle/oracle-database/23/netag/configuring-naming-methods.html `_. When using this option, you will still need to provide the ``user`` and ``password`` parameters, but the other parameters will no longer be used. Note that when using this parameter, the ``getHost`` and ``getPort`` methods from ``Doctrine\DBAL\Connection`` will no longer function as expected. @@ -335,7 +335,7 @@ pdo_sqlsrv / sqlsrv - ``host`` (string): Hostname of the database to connect to. - ``port`` (integer): Port of the database to connect to. - ``dbname`` (string): Name of the database/schema to connect to. -- ``driverOptions`` (array): Any supported options found on `https://learn.microsoft.com/en-us/sql/connect/php/connection-options` +- ``driverOptions`` (array): Any supported options found on `learn.microsoft.com/en-us/sql/connect/php/connection-options `_ ibm_db2 ^^^^^^^ @@ -347,7 +347,7 @@ ibm_db2 - ``host`` (string): Hostname of the database to connect to. - ``port`` (integer): Port of the database to connect to. - ``persistent`` (boolean): Whether to establish a persistent connection. -- ``driverOptions`` (array): Any supported options found on `https://www.php.net/manual/en/function.db2-connect.php#refsect1-function.db2-connect-parameters` +- ``driverOptions`` (array): Any supported options found on `www.php.net/manual/en/function.db2-connect.php#refsect1-function.db2-connect-parameters `_ Automatic platform version detection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 9715fe162b5e640903e3edf52e745e0d0f0087bd Mon Sep 17 00:00:00 2001 From: Adrien Foulon <6115458+Tofandel@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:33:50 +0200 Subject: [PATCH 5/7] Remove non thrown exception from phpdoc (#6574) | Q | A |------------- | ----------- | Type | bug --- src/Schema/Table.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Schema/Table.php b/src/Schema/Table.php index 2ee553e17a3..c7f593073db 100644 --- a/src/Schema/Table.php +++ b/src/Schema/Table.php @@ -276,10 +276,7 @@ final public function getRenamedColumns(): array return $this->renamedColumns; } - /** - * @throws LogicException - * @throws SchemaException - */ + /** @throws LogicException */ final public function renameColumn(string $oldName, string $newName): Column { $oldName = $this->normalizeIdentifier($oldName); From 516047cd40a2d43f7dcdf218b1ab77ccab2249ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 25 Oct 2024 11:35:09 +0200 Subject: [PATCH 6/7] Fix bigint PHP_INT_MIN/PHP_INT_MAX string to int convert (#6410) | Q | A |------------- | ----------- | Type | bug | Fixed issues | n/a #### Summary Resolve https://github.com/doctrine/dbal/pull/6177#discussion_r1613456751 discussion and related original #6177. Whole native php `int` range is guaranteed to be supported per https://www.doctrine-project.org/projects/doctrine-dbal/en/4.0/reference/types.html#bigint docs. --- psalm.xml.dist | 10 ++++++ src/Types/BigIntType.php | 11 +++--- tests/Functional/Types/BigIntTypeTest.php | 44 +++-------------------- 3 files changed, 21 insertions(+), 44 deletions(-) diff --git a/psalm.xml.dist b/psalm.xml.dist index 08cff97ebf8..52d088a15c9 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -131,6 +131,12 @@ + + + + + + @@ -185,6 +191,8 @@ + + @@ -291,6 +299,8 @@ + + diff --git a/src/Types/BigIntType.php b/src/Types/BigIntType.php index 0cb14c5b44c..a9b096785cb 100644 --- a/src/Types/BigIntType.php +++ b/src/Types/BigIntType.php @@ -47,15 +47,18 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): int return $value; } - if ($value > PHP_INT_MIN && $value < PHP_INT_MAX) { - return (int) $value; - } - assert( is_string($value), 'DBAL assumes values outside of the integer range to be returned as string by the database driver.', ); + if ( + ($value > PHP_INT_MIN && $value < PHP_INT_MAX) + || $value === (string) (int) $value + ) { + return (int) $value; + } + return $value; } } diff --git a/tests/Functional/Types/BigIntTypeTest.php b/tests/Functional/Types/BigIntTypeTest.php index 65dbdcfcdb9..386a8e91eec 100644 --- a/tests/Functional/Types/BigIntTypeTest.php +++ b/tests/Functional/Types/BigIntTypeTest.php @@ -10,8 +10,6 @@ use Doctrine\DBAL\Types\Types; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Constraint\IsIdentical; -use PHPUnit\Framework\Constraint\LogicalOr; use const PHP_INT_MAX; use const PHP_INT_MIN; @@ -49,44 +47,10 @@ public static function provideBigIntLiterals(): Generator yield 'null' => ['null', null]; yield 'positive number' => ['42', 42]; yield 'negative number' => ['-42', -42]; - - if (PHP_INT_SIZE < 8) { - // The following tests only work on 64bit systems. - return; - } - - yield 'large positive number' => ['9223372036854775806', PHP_INT_MAX - 1]; - yield 'large negative number' => ['-9223372036854775807', PHP_INT_MIN + 1]; - } - - #[DataProvider('provideBigIntEdgeLiterals')] - public function testSelectBigIntEdge(int $value): void - { - $table = new Table('bigint_type_test'); - $table->addColumn('id', Types::SMALLINT, ['notnull' => true]); - $table->addColumn('my_integer', Types::BIGINT, ['notnull' => false]); - $table->setPrimaryKey(['id']); - $this->dropAndCreateTable($table); - - $this->connection->executeStatement(<<connection->convertToPHPValue( - $this->connection->fetchOne('SELECT my_integer from bigint_type_test WHERE id = 42'), - Types::BIGINT, - ), - LogicalOr::fromConstraints(new IsIdentical($value), new IsIdentical((string) $value)), - ); - } - - /** @return Generator */ - public static function provideBigIntEdgeLiterals(): Generator - { - yield 'max int' => [PHP_INT_MAX]; - yield 'min int' => [PHP_INT_MIN]; + yield 'large positive number' => [PHP_INT_SIZE === 4 ? '2147483646' : '9223372036854775806', PHP_INT_MAX - 1]; + yield 'large negative number' => [PHP_INT_SIZE === 4 ? '-2147483647' : '-9223372036854775807', PHP_INT_MIN + 1]; + yield 'largest positive number' => [PHP_INT_SIZE === 4 ? '2147483647' : '9223372036854775807', PHP_INT_MAX]; + yield 'largest negative number' => [PHP_INT_SIZE === 4 ? '-2147483648' : '-9223372036854775808', PHP_INT_MIN]; } public function testUnsignedBigIntOnMySQL(): void From 19a5a350a81e56802ae13a225c350d5cada9655a Mon Sep 17 00:00:00 2001 From: Indra Gunawan Date: Fri, 25 Oct 2024 20:55:56 +0800 Subject: [PATCH 7/7] Run tests against PostgreSQL 17 (#6575) | Q | A |------------- | ----------- | Type | improvement | Fixed issues | #### Summary Run CI tests against Postgres 17. --- .github/workflows/continuous-integration.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 4be5b0ecc6e..ba7eca917f8 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -232,29 +232,29 @@ jobs: - "7.4" postgres-version: - "9.4" - - "15" - "16" + - "17" extension: - "pgsql" - "pdo_pgsql" include: - php-version: "8.2" - postgres-version: "16" + postgres-version: "17" extension: "pgsql" - php-version: "8.3" - postgres-version: "16" + postgres-version: "17" extension: "pgsql" - php-version: "8.4" - postgres-version: "16" + postgres-version: "17" extension: "pgsql" - php-version: "8.2" - postgres-version: "16" + postgres-version: "17" extension: "pdo_pgsql" - php-version: "8.3" - postgres-version: "16" + postgres-version: "17" extension: "pdo_pgsql" - php-version: "8.4" - postgres-version: "16" + postgres-version: "17" extension: "pdo_pgsql" services: