Skip to content

Commit 95bda94

Browse files
committed
Merge branch '4.3.x' into 4.4.x
* 4.3.x: feat: add more pdo jobs with stringify fetches (doctrine#7052) Fix case sensitivity in SQLite column types (doctrine#7050) Fix length type in `MySQLSchemaManager` with `ATTR_STRINGIFY_FETCHES` enabled (doctrine#7028) Fix Symfony 8 compatibility issues (doctrine#7009) Quote MySQL constraint names for foreign keys
2 parents aa26a19 + ca0c027 commit 95bda94

18 files changed

+247
-32
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
php-version: ${{ matrix.php-version }}
3636
extension: ${{ matrix.extension }}
3737
dependency-versions: ${{ matrix.dependency-versions }}
38+
config-file-suffix: ${{ matrix.config-file-suffix }}
3839

3940
strategy:
4041
matrix:
@@ -57,6 +58,11 @@ jobs:
5758
php-version: "8.4"
5859
dependency-versions: "highest"
5960
extension: "sqlite3"
61+
- os: "ubuntu-22.04"
62+
php-version: "8.2"
63+
dependency-versions: "highest"
64+
extension: "pdo_sqlite"
65+
config-file-suffix: "-stringify_fetches"
6066

6167
phpunit-oracle:
6268
name: "PHPUnit with Oracle"
@@ -95,6 +101,7 @@ jobs:
95101
postgres-version: ${{ matrix.postgres-version }}
96102
extension: ${{ matrix.extension }}
97103
postgres-locale-provider: ${{ matrix.postgres-locale-provider }}
104+
config-file-suffix: ${{ matrix.config-file-suffix }}
98105

99106
strategy:
100107
matrix:
@@ -121,6 +128,10 @@ jobs:
121128
postgres-version: "15"
122129
extension: "pdo_pgsql"
123130
postgres-locale-provider: "icu"
131+
- php-version: "8.2"
132+
postgres-version: "17"
133+
extension: "pdo_pgsql"
134+
config-file-suffix: "-stringify_fetches"
124135

125136
phpunit-mariadb:
126137
name: "PHPUnit with MariaDB"
@@ -130,6 +141,7 @@ jobs:
130141
php-version: ${{ matrix.php-version }}
131142
mariadb-version: ${{ matrix.mariadb-version }}
132143
extension: ${{ matrix.extension }}
144+
config-file-suffix: ${{ matrix.config-file-suffix }}
133145

134146
strategy:
135147
matrix:
@@ -154,6 +166,10 @@ jobs:
154166
- php-version: "8.2"
155167
mariadb-version: "11.4"
156168
extension: "pdo_mysql"
169+
- config-file-suffix: "-stringify_fetches"
170+
php-version: "8.2"
171+
mariadb-version: "11.4"
172+
extension: "pdo_mysql"
157173

158174
phpunit-mysql:
159175
name: "PHPUnit with MySQL"
@@ -182,6 +198,10 @@ jobs:
182198
php-version: "8.2"
183199
mysql-version: "9.1"
184200
extension: "mysqli"
201+
- config-file-suffix: "-stringify_fetches"
202+
php-version: "8.2"
203+
mysql-version: "9.1"
204+
extension: "pdo_mysql"
185205
- php-version: "8.2"
186206
mysql-version: "9.1"
187207
extension: "mysqli"
@@ -235,7 +255,7 @@ jobs:
235255
strategy:
236256
matrix:
237257
php-version:
238-
- "8.3"
258+
- "8.4"
239259

240260
steps:
241261
- name: "Checkout"
@@ -249,7 +269,9 @@ jobs:
249269
fail-fast: true
250270

251271
- name: "Lower minimum stability"
252-
run: "composer config minimum-stability dev"
272+
run: |
273+
composer config minimum-stability dev
274+
composer require --no-update --dev symfony/console:^8 symfony/cache:^8
253275
254276
- name: "Install development dependencies with Composer"
255277
uses: "ramsey/composer-install@v3"

.github/workflows/phpunit-mariadb.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
extension:
1313
required: true
1414
type: string
15+
config-file-suffix:
16+
required: false
17+
type: string
18+
default: ''
1519

1620
jobs:
1721
phpunit-mariadb:
@@ -53,5 +57,5 @@ jobs:
5357
- name: Upload coverage file
5458
uses: actions/upload-artifact@v4
5559
with:
56-
name: ${{ github.job }}-${{ inputs.mariadb-version }}-php-${{ inputs.php-version }}-${{ inputs.extension }}.coverage
60+
name: ${{ github.job }}-${{ inputs.mariadb-version }}-php-${{ inputs.php-version }}-${{ inputs.extension }}${{ inputs.config-file-suffix }}.coverage
5761
path: coverage.xml

.github/workflows/phpunit-postgres.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
postgres-locale-provider:
1616
required: true
1717
type: string
18+
config-file-suffix:
19+
required: false
20+
type: string
21+
default: ''
1822

1923
jobs:
2024
phpunit-postgres:
@@ -51,10 +55,10 @@ jobs:
5155
composer-options: '--ignore-platform-req=php+'
5256

5357
- name: Run PHPUnit
54-
run: vendor/bin/phpunit -c ci/github/phpunit/${{ inputs.extension }}.xml --coverage-clover=coverage.xml
58+
run: vendor/bin/phpunit -c ci/github/phpunit/${{ inputs.extension }}${{ inputs.config-file-suffix }}.xml --coverage-clover=coverage.xml
5559

5660
- name: Upload coverage file
5761
uses: actions/upload-artifact@v4
5862
with:
59-
name: ${{ github.job }}-${{ inputs.postgres-version }}-php-${{ inputs.php-version }}-${{ inputs.extension }}.coverage
63+
name: ${{ github.job }}-${{ inputs.postgres-version }}-php-${{ inputs.php-version }}-${{ inputs.extension }}${{ inputs.config-file-suffix }}.coverage
6064
path: coverage.xml

.github/workflows/phpunit-sqlite.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
dependency-versions:
1616
required: true
1717
type: string
18+
config-file-suffix:
19+
required: false
20+
type: string
21+
default: ''
1822

1923
jobs:
2024
phpunit-sqlite:
@@ -50,10 +54,10 @@ jobs:
5054
if: ${{ inputs.extension == 'sqlite3' }}
5155

5256
- name: Run PHPUnit
53-
run: vendor/bin/phpunit -c ci/github/phpunit/${{ inputs.extension }}.xml --coverage-clover=coverage.xml
57+
run: vendor/bin/phpunit -c ci/github/phpunit/${{ inputs.extension }}${{ inputs.config-file-suffix }}.xml --coverage-clover=coverage.xml
5458

5559
- name: Upload coverage file
5660
uses: actions/upload-artifact@v4
5761
with:
58-
name: ${{ github.job }}-php-${{ inputs.php-version }}-${{ inputs.extension }}-${{ inputs.dependency-versions }}.coverage
62+
name: ${{ github.job }}-php-${{ inputs.php-version }}-${{ inputs.extension }}${{ inputs.config-file-suffix }}-${{ inputs.dependency-versions }}.coverage
5963
path: coverage.xml
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
4+
colors="true"
5+
beStrictAboutOutputDuringTests="true"
6+
failOnRisky="true"
7+
failOnWarning="true"
8+
failOnNotice="true"
9+
failOnPhpunitDeprecation="true"
10+
displayDetailsOnTestsThatTriggerErrors="true"
11+
displayDetailsOnTestsThatTriggerDeprecations="true"
12+
>
13+
<php>
14+
<ini name="error_reporting" value="-1" />
15+
16+
<var name="db_driver" value="pdo_mysql"/>
17+
<!-- see \PDO::ATTR_STRINGIFY_FETCHES-->
18+
<var name="db_driver_option_17" value="true"/>
19+
<var name="db_host" value="127.0.0.1" />
20+
<var name="db_port" value="3306"/>
21+
<var name="db_user" value="root" />
22+
<var name="db_dbname" value="doctrine_tests" />
23+
<var name="db_charset" value="utf8mb4" />
24+
</php>
25+
26+
<testsuites>
27+
<testsuite name="Doctrine DBAL Test Suite">
28+
<directory>../../../tests</directory>
29+
</testsuite>
30+
</testsuites>
31+
32+
<source>
33+
<include>
34+
<directory>../../../src</directory>
35+
</include>
36+
</source>
37+
</phpunit>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
4+
colors="true"
5+
beStrictAboutOutputDuringTests="true"
6+
failOnRisky="true"
7+
failOnWarning="true"
8+
failOnNotice="true"
9+
failOnPhpunitDeprecation="true"
10+
displayDetailsOnTestsThatTriggerErrors="true"
11+
displayDetailsOnTestsThatTriggerDeprecations="true"
12+
>
13+
<php>
14+
<ini name="error_reporting" value="-1" />
15+
16+
<var name="db_driver" value="pdo_pgsql"/>
17+
<!-- see \PDO::ATTR_STRINGIFY_FETCHES-->
18+
<var name="db_driver_option_17" value="true"/>
19+
<var name="db_host" value="localhost" />
20+
<var name="db_user" value="postgres" />
21+
<var name="db_password" value="postgres" />
22+
<var name="db_dbname" value="doctrine_tests" />
23+
</php>
24+
25+
<testsuites>
26+
<testsuite name="Doctrine DBAL Test Suite">
27+
<directory>../../../tests</directory>
28+
</testsuite>
29+
</testsuites>
30+
31+
<source>
32+
<include>
33+
<directory>../../../src</directory>
34+
</include>
35+
</source>
36+
</phpunit>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
4+
colors="true"
5+
beStrictAboutOutputDuringTests="true"
6+
failOnRisky="true"
7+
failOnWarning="true"
8+
failOnNotice="true"
9+
failOnPhpunitDeprecation="true"
10+
displayDetailsOnTestsThatTriggerErrors="true"
11+
displayDetailsOnTestsThatTriggerDeprecations="true"
12+
>
13+
<php>
14+
<ini name="error_reporting" value="-1" />
15+
16+
<var name="db_driver" value="pdo_sqlite"/>
17+
<!-- see \PDO::ATTR_STRINGIFY_FETCHES-->
18+
<var name="db_driver_option_17" value="true"/>
19+
<var name="db_memory" value="true"/>
20+
</php>
21+
22+
<testsuites>
23+
<testsuite name="Doctrine DBAL Test Suite">
24+
<directory>../../../tests</directory>
25+
</testsuite>
26+
</testsuites>
27+
28+
<source>
29+
<include>
30+
<directory>../../../src</directory>
31+
</include>
32+
</source>
33+
</phpunit>

src/Schema/MySQLSchemaManager.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ protected function _getPortableTableColumnDefinition(array $tableColumn): Column
130130
switch ($dbType) {
131131
case 'char':
132132
case 'varchar':
133-
$length = $tableColumn['character_maximum_length'];
133+
$length = (int) $tableColumn['character_maximum_length'];
134134
break;
135135

136136
case 'binary':
137137
case 'varbinary':
138-
$length = $tableColumn['character_octet_length'];
138+
$length = (int) $tableColumn['character_octet_length'];
139139
break;
140140

141141
case 'tinytext':
@@ -167,10 +167,10 @@ protected function _getPortableTableColumnDefinition(array $tableColumn): Column
167167
case 'real':
168168
case 'numeric':
169169
case 'decimal':
170-
$precision = $tableColumn['numeric_precision'];
170+
$precision = (int) $tableColumn['numeric_precision'];
171171

172172
if (isset($tableColumn['numeric_scale'])) {
173-
$scale = $tableColumn['numeric_scale'];
173+
$scale = (int) $tableColumn['numeric_scale'];
174174
}
175175

176176
break;
@@ -280,7 +280,7 @@ protected function _getPortableTableForeignKeysList(array $rows): array
280280
}
281281

282282
$list[$row['constraint_name']] = [
283-
'name' => $row['constraint_name'],
283+
'name' => $this->getQuotedIdentifierName($row['constraint_name']),
284284
'local' => [],
285285
'foreign' => [],
286286
'foreignTable' => $row['referenced_table_name'],
@@ -524,4 +524,14 @@ private function getDefaultTableOptions(): DefaultTableOptions
524524

525525
return $this->defaultTableOptions;
526526
}
527+
528+
/** Returns the quoted representation of the given identifier name. */
529+
private function getQuotedIdentifierName(?string $identifier): ?string
530+
{
531+
if ($identifier === null) {
532+
return null;
533+
}
534+
535+
return $this->platform->quoteSingleIdentifier($identifier);
536+
}
527537
}

src/Schema/PostgreSQLSchemaManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey)
128128
[
129129
'onUpdate' => $onUpdate,
130130
'onDelete' => $onDelete,
131-
'deferrable' => $tableForeignKey['condeferrable'],
132-
'deferred' => $tableForeignKey['condeferred'],
131+
'deferrable' => (bool) $tableForeignKey['condeferrable'],
132+
'deferred' => (bool) $tableForeignKey['condeferred'],
133133
],
134134
);
135135
}
@@ -170,7 +170,7 @@ static function (array $row): array {
170170
return [
171171
'key_name' => $row['relname'],
172172
'non_unique' => ! $row['indisunique'],
173-
'primary' => $row['indisprimary'],
173+
'primary' => (bool) $row['indisprimary'],
174174
'where' => $row['where'],
175175
'column_name' => $row['attname'],
176176
];

src/Schema/SQLiteSchemaManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function _getPortableTableDefinition(array $table): string
7373
*/
7474
protected function _getPortableTableColumnDefinition(array $tableColumn): Column
7575
{
76-
$matchResult = preg_match('/^([A-Z\s]+?)(?:\s*\((\d+)(?:,\s*(\d+))?\))?$/', $tableColumn['type'], $matches);
76+
$matchResult = preg_match('/^([A-Z\s]+?)(?:\s*\((\d+)(?:,\s*(\d+))?\))?$/i', $tableColumn['type'], $matches);
7777
assert($matchResult === 1);
7878

7979
$dbType = strtolower($matches[1]);

0 commit comments

Comments
 (0)