Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a6350ad

Browse files
Merge pull request #19497 from MauricioFauth/csv-excel-export-plugin
Remove excel_* and csv_* global variables
2 parents ef9ecd7 + 6e8e98c commit a6350ad

File tree

8 files changed

+409
-381
lines changed

8 files changed

+409
-381
lines changed

phpstan-baseline.neon

Lines changed: 33 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11428,35 +11428,11 @@ parameters:
1142811428
path: src/Plugins/Export/ExportCodegen.php
1142911429

1143011430
-
11431-
message: '#^Binary operation "\." between mixed and \(list\<string\>\|string\) results in an error\.$#'
11431+
message: '#^Binary operation "\." between non\-empty\-string and \(list\<string\>\|string\) results in an error\.$#'
1143211432
identifier: binaryOp.invalid
1143311433
count: 1
1143411434
path: src/Plugins/Export/ExportCsv.php
1143511435

11436-
-
11437-
message: '#^Binary operation "\." between mixed and mixed results in an error\.$#'
11438-
identifier: binaryOp.invalid
11439-
count: 4
11440-
path: src/Plugins/Export/ExportCsv.php
11441-
11442-
-
11443-
message: '#^Binary operation "\." between mixed and string results in an error\.$#'
11444-
identifier: binaryOp.invalid
11445-
count: 2
11446-
path: src/Plugins/Export/ExportCsv.php
11447-
11448-
-
11449-
message: '#^Binary operation "\." between non\-empty\-string and mixed results in an error\.$#'
11450-
identifier: binaryOp.invalid
11451-
count: 3
11452-
path: src/Plugins/Export/ExportCsv.php
11453-
11454-
-
11455-
message: '#^Binary operation "\." between string and mixed results in an error\.$#'
11456-
identifier: binaryOp.invalid
11457-
count: 2
11458-
path: src/Plugins/Export/ExportCsv.php
11459-
1146011436
-
1146111437
message: '''
1146211438
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Dbal\\DatabaseInterface\:
@@ -11487,56 +11463,65 @@ parameters:
1148711463
-
1148811464
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
1148911465
identifier: empty.notAllowed
11490-
count: 2
11466+
count: 1
1149111467
path: src/Plugins/Export/ExportCsv.php
1149211468

1149311469
-
11494-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
11495-
identifier: notEqual.notAllowed
11470+
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, mixed given\.$#'
11471+
identifier: argument.type
1149611472
count: 1
1149711473
path: src/Plugins/Export/ExportCsv.php
1149811474

1149911475
-
11500-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
11501-
identifier: equal.notAllowed
11476+
message: '#^Binary operation "\." between non\-empty\-string and \(list\<string\>\|string\) results in an error\.$#'
11477+
identifier: binaryOp.invalid
11478+
count: 1
11479+
path: src/Plugins/Export/ExportExcel.php
11480+
11481+
-
11482+
message: '''
11483+
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Dbal\\DatabaseInterface\:
11484+
Use dependency injection instead\.$#
11485+
'''
11486+
identifier: staticMethod.deprecated
1150211487
count: 2
11503-
path: src/Plugins/Export/ExportCsv.php
11488+
path: src/Plugins/Export/ExportExcel.php
1150411489

1150511490
-
11506-
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
11507-
identifier: booleanAnd.rightNotBoolean
11508-
count: 3
11509-
path: src/Plugins/Export/ExportCsv.php
11491+
message: '#^Cannot access offset ''columns'' on mixed\.$#'
11492+
identifier: offsetAccess.nonOffsetAccessible
11493+
count: 1
11494+
path: src/Plugins/Export/ExportExcel.php
1151011495

1151111496
-
11512-
message: '#^Parameter \#1 \$search of function str_replace expects array\<string\>\|string, mixed given\.$#'
11513-
identifier: argument.type
11514-
count: 4
11515-
path: src/Plugins/Export/ExportCsv.php
11497+
message: '#^Cannot access offset ''tables'' on mixed\.$#'
11498+
identifier: offsetAccess.nonOffsetAccessible
11499+
count: 1
11500+
path: src/Plugins/Export/ExportExcel.php
1151611501

1151711502
-
11518-
message: '#^Parameter \#1 \$separator of function implode expects array\|string, mixed given\.$#'
11519-
identifier: argument.type
11503+
message: '#^Cannot access offset string on mixed\.$#'
11504+
identifier: offsetAccess.nonOffsetAccessible
1152011505
count: 2
11521-
path: src/Plugins/Export/ExportCsv.php
11506+
path: src/Plugins/Export/ExportExcel.php
1152211507

1152311508
-
11524-
message: '#^Parameter \#1 \$string of function mb_strtolower expects string, mixed given\.$#'
11525-
identifier: argument.type
11509+
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
11510+
identifier: empty.notAllowed
1152611511
count: 1
11527-
path: src/Plugins/Export/ExportCsv.php
11512+
path: src/Plugins/Export/ExportExcel.php
1152811513

1152911514
-
1153011515
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, mixed given\.$#'
1153111516
identifier: argument.type
11532-
count: 3
11533-
path: src/Plugins/Export/ExportCsv.php
11517+
count: 1
11518+
path: src/Plugins/Export/ExportExcel.php
1153411519

1153511520
-
1153611521
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, string\|null given\.$#'
1153711522
identifier: argument.type
1153811523
count: 3
11539-
path: src/Plugins/Export/ExportCsv.php
11524+
path: src/Plugins/Export/ExportExcel.php
1154011525

1154111526
-
1154211527
message: '#^Binary operation "\." between ''\<html xmlns\:o\="urn…'' and mixed results in an error\.$#'

psalm-baseline.xml

Lines changed: 16 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,17 +1418,6 @@
14181418
<MixedAssignment>
14191419
<code><![CDATA[$GLOBALS['charset']]]></code>
14201420
<code><![CDATA[$GLOBALS['compression']]]></code>
1421-
<code><![CDATA[$GLOBALS['csv_columns']]]></code>
1422-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
1423-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
1424-
<code><![CDATA[$GLOBALS['csv_null']]]></code>
1425-
<code><![CDATA[$GLOBALS['csv_removeCRLF']]]></code>
1426-
<code><![CDATA[$GLOBALS['csv_separator']]]></code>
1427-
<code><![CDATA[$GLOBALS['csv_terminated']]]></code>
1428-
<code><![CDATA[$GLOBALS['excel_columns']]]></code>
1429-
<code><![CDATA[$GLOBALS['excel_edition']]]></code>
1430-
<code><![CDATA[$GLOBALS['excel_null']]]></code>
1431-
<code><![CDATA[$GLOBALS['excel_removeCRLF']]]></code>
14321421
<code><![CDATA[$GLOBALS['knjenc']]]></code>
14331422
<code><![CDATA[$GLOBALS['maxsize']]]></code>
14341423
<code><![CDATA[$GLOBALS['save_filename']]]></code>
@@ -6730,53 +6719,32 @@
67306719
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
67316720
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
67326721
</DeprecatedMethod>
6733-
<InvalidArrayOffset>
6734-
<code><![CDATA[$GLOBALS['csv_null']]]></code>
6735-
<code><![CDATA[$GLOBALS['csv_removeCRLF']]]></code>
6736-
<code><![CDATA[$GLOBALS['excel_columns']]]></code>
6737-
<code><![CDATA[$GLOBALS['excel_null']]]></code>
6738-
<code><![CDATA[$GLOBALS['excel_removeCRLF']]]></code>
6739-
</InvalidArrayOffset>
67406722
<MixedArgument>
67416723
<code><![CDATA[$colAs]]></code>
67426724
</MixedArgument>
67436725
<MixedArgumentTypeCoercion>
67446726
<code><![CDATA[$insertFields]]></code>
6745-
<code><![CDATA[$insertValues]]></code>
67466727
</MixedArgumentTypeCoercion>
67476728
<MixedAssignment>
67486729
<code><![CDATA[$colAs]]></code>
67496730
<code><![CDATA[$insertFields[]]]></code>
6750-
<code><![CDATA[$insertValues[]]]></code>
67516731
</MixedAssignment>
6752-
<PossiblyNullArgument>
6753-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6754-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6755-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6756-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6757-
<code><![CDATA[$GLOBALS['csv_separator']]]></code>
6758-
</PossiblyNullArgument>
6759-
<PossiblyNullOperand>
6760-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6761-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6762-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6763-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6764-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6765-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6766-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6767-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6768-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6769-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6770-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6771-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6772-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6773-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6774-
<code><![CDATA[$GLOBALS['csv_terminated']]]></code>
6775-
<code><![CDATA[$GLOBALS['csv_terminated']]]></code>
6776-
</PossiblyNullOperand>
6777-
<RiskyTruthyFalsyComparison>
6778-
<code><![CDATA[empty($GLOBALS['csv_terminated'])]]></code>
6779-
</RiskyTruthyFalsyComparison>
6732+
</file>
6733+
<file src="src/Plugins/Export/ExportExcel.php">
6734+
<DeprecatedMethod>
6735+
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
6736+
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
6737+
</DeprecatedMethod>
6738+
<MixedArgument>
6739+
<code><![CDATA[$colAs]]></code>
6740+
</MixedArgument>
6741+
<MixedArgumentTypeCoercion>
6742+
<code><![CDATA[$insertFields]]></code>
6743+
</MixedArgumentTypeCoercion>
6744+
<MixedAssignment>
6745+
<code><![CDATA[$colAs]]></code>
6746+
<code><![CDATA[$insertFields[]]]></code>
6747+
</MixedAssignment>
67806748
</file>
67816749
<file src="src/Plugins/Export/ExportHtmlword.php">
67826750
<DeprecatedMethod>
@@ -12741,26 +12709,6 @@
1274112709
<code><![CDATA[providerForTestValidPlugins]]></code>
1274212710
</PossiblyUnusedMethod>
1274312711
</file>
12744-
<file src="tests/unit/Plugins/Export/ExportExcelTest.php">
12745-
<DocblockTypeContradiction>
12746-
<code><![CDATA[assertSame]]></code>
12747-
</DocblockTypeContradiction>
12748-
<RedundantCondition>
12749-
<code><![CDATA[assertFalse]]></code>
12750-
<code><![CDATA[assertSame]]></code>
12751-
<code><![CDATA[assertTrue]]></code>
12752-
</RedundantCondition>
12753-
<RedundantConditionGivenDocblockType>
12754-
<code><![CDATA[assertFalse]]></code>
12755-
<code><![CDATA[assertSame]]></code>
12756-
<code><![CDATA[assertSame]]></code>
12757-
<code><![CDATA[assertSame]]></code>
12758-
<code><![CDATA[assertSame]]></code>
12759-
<code><![CDATA[assertSame]]></code>
12760-
<code><![CDATA[assertSame]]></code>
12761-
<code><![CDATA[assertSame]]></code>
12762-
</RedundantConditionGivenDocblockType>
12763-
</file>
1276412712
<file src="tests/unit/Plugins/Export/ExportHtmlwordTest.php">
1276512713
<DeprecatedMethod>
1276612714
<code><![CDATA[Config::getInstance()]]></code>

psalm.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,9 @@
4646
complete_query: string,
4747
compression: 'none'|'zip'|'gzip',
4848
conn_error: string,
49-
csv_columns: bool,
50-
csv_enclosed: string,
51-
csv_escaped: string,
52-
csv_separator: string,
53-
csv_terminated: string,
5449
display_query: string,
5550
errno: int,
5651
error: bool,
57-
excel_edition: 'win'|'mac_excel2003'|'mac_excel2008',
5852
file_handle: resource|null,
5953
from_cookie: bool,
6054
hostname: string,

src/Controllers/Export/ExportController.php

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -489,53 +489,10 @@ private function setGlobalsFromRequest(array $postParams): void
489489
$GLOBALS['knjenc'] = $postParams['knjenc'];
490490
}
491491

492-
if (isset($postParams['xkana'])) {
493-
$GLOBALS['xkana'] = $postParams['xkana'];
492+
if (! isset($postParams['xkana'])) {
493+
return;
494494
}
495495

496-
if (isset($postParams['excel_null'])) {
497-
$GLOBALS['excel_null'] = $postParams['excel_null'];
498-
}
499-
500-
if (isset($postParams['excel_removeCRLF'])) {
501-
$GLOBALS['excel_removeCRLF'] = $postParams['excel_removeCRLF'];
502-
}
503-
504-
if (isset($postParams['excel_columns'])) {
505-
$GLOBALS['excel_columns'] = $postParams['excel_columns'];
506-
}
507-
508-
if (isset($postParams['excel_edition'])) {
509-
$GLOBALS['excel_edition'] = $postParams['excel_edition'];
510-
}
511-
512-
if (isset($postParams['csv_separator'])) {
513-
$GLOBALS['csv_separator'] = $postParams['csv_separator'];
514-
}
515-
516-
if (isset($postParams['csv_enclosed'])) {
517-
$GLOBALS['csv_enclosed'] = $postParams['csv_enclosed'];
518-
}
519-
520-
if (isset($postParams['csv_escaped'])) {
521-
$GLOBALS['csv_escaped'] = $postParams['csv_escaped'];
522-
}
523-
524-
if (isset($postParams['csv_terminated'])) {
525-
$GLOBALS['csv_terminated'] = $postParams['csv_terminated'];
526-
}
527-
528-
if (isset($postParams['csv_null'])) {
529-
$GLOBALS['csv_null'] = $postParams['csv_null'];
530-
}
531-
532-
if (isset($postParams['csv_removeCRLF'])) {
533-
$GLOBALS['csv_removeCRLF'] = $postParams['csv_removeCRLF'];
534-
}
535-
536-
// phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed
537-
if (isset($postParams['csv_columns'])) {
538-
$GLOBALS['csv_columns'] = $postParams['csv_columns'];
539-
}
496+
$GLOBALS['xkana'] = $postParams['xkana'];
540497
}
541498
}

0 commit comments

Comments
 (0)