Skip to content

Commit d7a918e

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.com.br>
2 parents 7942f21 + c1fe162 commit d7a918e

6 files changed

Lines changed: 105 additions & 18 deletions

File tree

‎bin/internal/check-release-excludes.sh‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,33 @@ for filePath in ${FILE_LIST}; do
194194
case $filePath in
195195
*/composer-require-checker.json)
196196
foundFile;;
197-
*/CLAUDE.MD)
197+
*/.phpstorm.meta.php)
198+
foundFile;;
199+
*/CLAUDE.[Mm][Dd])
200+
foundFile;;
201+
*/AGENTS.[Mm][Dd])
202+
foundFile;;
203+
*/UPGRADING.md)
204+
foundFile;;
205+
*/UPGRADE.md)
206+
foundFile;;
207+
*/UPGRADE-*.md)
208+
foundFile;;
209+
*/SECURITY.md)
210+
foundFile;;
211+
*/.gitlab-ci.yml)
212+
foundFile;;
213+
*/.tool-versions)
214+
foundFile;;
215+
*/.phive/*)
216+
foundFile;;
217+
*/.phpdoc/*)
218+
foundFile;;
219+
*/vendor/*/guides/*)
220+
foundFile;;
221+
*/vendor/*/benchmark/*)
222+
foundFile;;
223+
*/vendor/*/benchmarks/*)
198224
foundFile;;
199225
*/Readme.php)
200226
foundFile;;
@@ -256,6 +282,8 @@ for filePath in ${FILE_LIST}; do
256282
foundFile;;
257283
*/codecov.yml)
258284
foundFile;;
285+
*/.codecov.yml)
286+
foundFile;;
259287
*/.gitattributes)
260288
foundFile;;
261289
*/.gitignore)

‎bin/internal/create-release.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ cleanup_composer_vendors() {
176176
vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.*/ \
177177
vendor/tecnickcom/tcpdf/fonts/freefont-*/ \
178178
vendor/tecnickcom/tcpdf/include/sRGB.icc \
179+
vendor/tecnickcom/tcpdf/Makefile \
179180
vendor/williamdes/mariadb-mysql-kbs/schemas/ \
180181
vendor/williamdes/mariadb-mysql-kbs/dist/merged-raw.json \
181182
vendor/williamdes/mariadb-mysql-kbs/dist/merged-raw.md \

‎src/CreateAddField.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public function __construct(private DatabaseInterface $dbi)
3636
private function getIndexedColumns(): array
3737
{
3838
$fieldCount = count($_POST['field_name']);
39-
$fieldPrimary = json_decode($_POST['primary_indexes'], true);
40-
$fieldIndex = json_decode($_POST['indexes'], true);
41-
$fieldUnique = json_decode($_POST['unique_indexes'], true);
42-
$fieldFullText = json_decode($_POST['fulltext_indexes'], true);
43-
$fieldSpatial = json_decode($_POST['spatial_indexes'], true);
39+
$fieldPrimary = json_decode($_POST['primary_indexes'] ?? '[]', true);
40+
$fieldIndex = json_decode($_POST['indexes'] ?? '[]', true);
41+
$fieldUnique = json_decode($_POST['unique_indexes'] ?? '[]', true);
42+
$fieldFullText = json_decode($_POST['fulltext_indexes'] ?? '[]', true);
43+
$fieldSpatial = json_decode($_POST['spatial_indexes'] ?? '[]', true);
4444

4545
return [$fieldCount, $fieldPrimary, $fieldIndex, $fieldUnique, $fieldFullText, $fieldSpatial];
4646
}

‎src/Util.php‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,20 @@ public static function getMySQLDocuURL(string $link, string $anchor = ''): strin
182182
$link = 'index';
183183
}
184184

185-
$mysql = '5.5';
185+
$mysql = '5.7';
186186
$lang = 'en';
187187
$dbi = DatabaseInterface::getInstance();
188188
if ($dbi->isConnected()) {
189189
$serverVersion = $dbi->getVersion();
190-
if ($serverVersion >= 80000) {
190+
if ($serverVersion >= 90000) {
191+
$mysql = '9.0';
192+
} elseif ($serverVersion >= 80000) {
191193
$mysql = '8.0';
192-
} elseif ($serverVersion >= 50700) {
193-
$mysql = '5.7';
194-
} elseif ($serverVersion >= 50600) {
195-
$mysql = '5.6';
196194
}
197195
}
198196

199-
$url = 'https://dev.mysql.com/doc/refman/' . $mysql . '/' . $lang . '/' . $link . '.html';
197+
$section = $link === 'server-error-reference' ? 'mysql-errors' : 'refman';
198+
$url = 'https://dev.mysql.com/doc/' . $section . '/' . $mysql . '/' . $lang . '/' . $link . '.html';
200199
if ($anchor !== '') {
201200
$url .= '#' . $anchor;
202201
}
@@ -974,7 +973,7 @@ public static function extractColumnSpec(string $columnSpecification): array
974973
$zerofill = $zerofillCount > 0;
975974
$printType = (string) preg_replace('@unsigned@', '', $printType, -1, $unsignedCount);
976975
$unsigned = $unsignedCount > 0;
977-
$printType = (string) preg_replace('@\/\*!100301 compressed\*\/@', '', $printType, -1, $compressedCount);
976+
$printType = (string) preg_replace('@\/\*m?!100301 compressed\*\/@', '', $printType, -1, $compressedCount);
978977
$compressed = $compressedCount > 0;
979978
$printType = trim($printType);
980979
}

‎tests/unit/CreateAddFieldTest.php‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,4 +465,48 @@ public function testGetColumnCreationQuery(string $expected, array $request): vo
465465
$sqlQuery = $this->createAddField->getColumnCreationQuery('my_table');
466466
self::assertSame($expected, $sqlQuery);
467467
}
468+
469+
/**
470+
* Adding a column must not fail when the request does not contain the index
471+
* arrays (primary_indexes, indexes, unique_indexes, fulltext_indexes and
472+
* spatial_indexes). This happens for instance when a primary key column is
473+
* added from the normalization page, which does not submit those fields.
474+
*
475+
* Regression test for https://github.com/phpmyadmin/phpmyadmin/issues/18304
476+
*/
477+
public function testGetColumnCreationQueryWithoutIndexPostVariables(): void
478+
{
479+
$_POST = [
480+
'db' => '2fa',
481+
'field_where' => 'after',
482+
'after_field' => 'd',
483+
'table' => 'aes',
484+
'orig_num_fields' => '1',
485+
'orig_field_where' => 'after',
486+
'orig_after_field' => 'd',
487+
'field_name' => ['dd'],
488+
'field_type' => ['INT'],
489+
'field_length' => [''],
490+
'field_default_type' => ['NONE'],
491+
'field_default_value' => [''],
492+
'field_collation' => [''],
493+
'field_attribute' => [''],
494+
'field_key' => ['none_0'],
495+
'field_comments' => [''],
496+
'field_virtuality' => [''],
497+
'field_expression' => [''],
498+
'field_move_to' => [''],
499+
'field_mimetype' => [''],
500+
'field_transformation' => [''],
501+
'field_transformation_options' => [''],
502+
'field_input_transformation' => [''],
503+
'field_input_transformation_options' => [''],
504+
'do_save_data' => '1',
505+
'preview_sql' => '1',
506+
'ajax_request' => '1',
507+
];
508+
509+
$sqlQuery = $this->createAddField->getColumnCreationQuery('my_table');
510+
self::assertSame('ALTER TABLE `my_table` ADD `dd` INT NOT NULL AFTER `d`;', $sqlQuery);
511+
}
468512
}

‎tests/unit/UtilTest.php‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,21 @@ public static function providerExtractColumnSpec(): array
332332
'displayed_type' => 'varchar(11)',
333333
],
334334
],
335+
[
336+
'varchar(11) /*M!100301 COMPRESSED*/',
337+
[
338+
'type' => 'varchar',
339+
'print_type' => 'varchar(11)',
340+
'binary' => false,
341+
'unsigned' => false,
342+
'zerofill' => false,
343+
'spec_in_brackets' => '11',
344+
'enum_set_values' => [],
345+
'attribute' => 'COMPRESSED=zlib',
346+
'can_contain_collation' => true,
347+
'displayed_type' => 'varchar(11)',
348+
],
349+
],
335350
];
336351
}
337352

@@ -1300,14 +1315,14 @@ public static function providerForTestGetMySQLDocuURL(): array
13001315
'alter-table-index',
13011316
'5.6.0',
13021317
'index.php?route=/url&url='
1303-
. 'https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.6%2Fen%2Findex.html%23alter-table-index',
1318+
. 'https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.7%2Fen%2Findex.html%23alter-table-index',
13041319
],
13051320
[
13061321
'ALTER_TABLE',
13071322
'',
13081323
'5.5.0',
13091324
'index.php?route=/url&url='
1310-
. 'https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Falter-table.html',
1325+
. 'https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.7%2Fen%2Falter-table.html',
13111326
],
13121327
[
13131328
'',
@@ -1329,11 +1344,11 @@ public function testGetDocuURL(): void
13291344
Util::getDocuURL(true),
13301345
);
13311346
self::assertSame(
1332-
'index.php?route=/url&url=https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Findex.html',
1347+
'index.php?route=/url&url=https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.7%2Fen%2Findex.html',
13331348
Util::getDocuURL(false),
13341349
);
13351350
self::assertSame(
1336-
'index.php?route=/url&url=https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Findex.html',
1351+
'index.php?route=/url&url=https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.7%2Fen%2Findex.html',
13371352
Util::getDocuURL(),
13381353
);
13391354
}

0 commit comments

Comments
 (0)