Skip to content

Commit 6e8e98c

Browse files
committed
Remove csv_* global variables
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
1 parent 1c57a44 commit 6e8e98c

6 files changed

Lines changed: 93 additions & 252 deletions

File tree

phpstan-baseline.neon

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -11434,35 +11434,11 @@ parameters:
1143411434
path: src/Plugins/Export/ExportCodegen.php
1143511435

1143611436
-
11437-
message: '#^Binary operation "\." between mixed and \(list\<string\>\|string\) results in an error\.$#'
11437+
message: '#^Binary operation "\." between non\-empty\-string and \(list\<string\>\|string\) results in an error\.$#'
1143811438
identifier: binaryOp.invalid
1143911439
count: 1
1144011440
path: src/Plugins/Export/ExportCsv.php
1144111441

11442-
-
11443-
message: '#^Binary operation "\." between mixed and mixed results in an error\.$#'
11444-
identifier: binaryOp.invalid
11445-
count: 4
11446-
path: src/Plugins/Export/ExportCsv.php
11447-
11448-
-
11449-
message: '#^Binary operation "\." between mixed and string results in an error\.$#'
11450-
identifier: binaryOp.invalid
11451-
count: 2
11452-
path: src/Plugins/Export/ExportCsv.php
11453-
11454-
-
11455-
message: '#^Binary operation "\." between non\-empty\-string and mixed results in an error\.$#'
11456-
identifier: binaryOp.invalid
11457-
count: 3
11458-
path: src/Plugins/Export/ExportCsv.php
11459-
11460-
-
11461-
message: '#^Binary operation "\." between string and mixed results in an error\.$#'
11462-
identifier: binaryOp.invalid
11463-
count: 2
11464-
path: src/Plugins/Export/ExportCsv.php
11465-
1146611442
-
1146711443
message: '''
1146811444
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Dbal\\DatabaseInterface\:
@@ -11493,49 +11469,13 @@ parameters:
1149311469
-
1149411470
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
1149511471
identifier: empty.notAllowed
11496-
count: 2
11497-
path: src/Plugins/Export/ExportCsv.php
11498-
11499-
-
11500-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
11501-
identifier: notEqual.notAllowed
11502-
count: 1
11503-
path: src/Plugins/Export/ExportCsv.php
11504-
11505-
-
11506-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
11507-
identifier: equal.notAllowed
11508-
count: 2
11509-
path: src/Plugins/Export/ExportCsv.php
11510-
11511-
-
11512-
message: '#^Only booleans are allowed in &&, mixed given on the right side\.$#'
11513-
identifier: booleanAnd.rightNotBoolean
11514-
count: 2
11515-
path: src/Plugins/Export/ExportCsv.php
11516-
11517-
-
11518-
message: '#^Parameter \#1 \$search of function str_replace expects array\<string\>\|string, mixed given\.$#'
11519-
identifier: argument.type
11520-
count: 4
11521-
path: src/Plugins/Export/ExportCsv.php
11522-
11523-
-
11524-
message: '#^Parameter \#1 \$separator of function implode expects array\|string, mixed given\.$#'
11525-
identifier: argument.type
11526-
count: 2
11527-
path: src/Plugins/Export/ExportCsv.php
11528-
11529-
-
11530-
message: '#^Parameter \#1 \$string of function mb_strtolower expects string, mixed given\.$#'
11531-
identifier: argument.type
1153211472
count: 1
1153311473
path: src/Plugins/Export/ExportCsv.php
1153411474

1153511475
-
1153611476
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, mixed given\.$#'
1153711477
identifier: argument.type
11538-
count: 3
11478+
count: 1
1153911479
path: src/Plugins/Export/ExportCsv.php
1154011480

1154111481
-

psalm-baseline.xml

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,13 +1420,6 @@
14201420
<MixedAssignment>
14211421
<code><![CDATA[$GLOBALS['charset']]]></code>
14221422
<code><![CDATA[$GLOBALS['compression']]]></code>
1423-
<code><![CDATA[$GLOBALS['csv_columns']]]></code>
1424-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
1425-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
1426-
<code><![CDATA[$GLOBALS['csv_null']]]></code>
1427-
<code><![CDATA[$GLOBALS['csv_removeCRLF']]]></code>
1428-
<code><![CDATA[$GLOBALS['csv_separator']]]></code>
1429-
<code><![CDATA[$GLOBALS['csv_terminated']]]></code>
14301423
<code><![CDATA[$GLOBALS['knjenc']]]></code>
14311424
<code><![CDATA[$GLOBALS['maxsize']]]></code>
14321425
<code><![CDATA[$GLOBALS['save_filename']]]></code>
@@ -6730,53 +6723,16 @@
67306723
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
67316724
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
67326725
</DeprecatedMethod>
6733-
<InvalidArrayOffset>
6734-
<code><![CDATA[$GLOBALS['csv_null']]]></code>
6735-
</InvalidArrayOffset>
67366726
<MixedArgument>
67376727
<code><![CDATA[$colAs]]></code>
67386728
</MixedArgument>
67396729
<MixedArgumentTypeCoercion>
67406730
<code><![CDATA[$insertFields]]></code>
6741-
<code><![CDATA[$insertValues]]></code>
67426731
</MixedArgumentTypeCoercion>
67436732
<MixedAssignment>
67446733
<code><![CDATA[$colAs]]></code>
67456734
<code><![CDATA[$insertFields[]]]></code>
6746-
<code><![CDATA[$insertValues[]]]></code>
67476735
</MixedAssignment>
6748-
<PossiblyNullArgument>
6749-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6750-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6751-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6752-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6753-
<code><![CDATA[$GLOBALS['csv_separator']]]></code>
6754-
</PossiblyNullArgument>
6755-
<PossiblyNullOperand>
6756-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6757-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6758-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
6759-
<code><![CDATA[$GLOBALS['csv_enclosed']]]></code>
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_escaped']]]></code>
6766-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6767-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6768-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6769-
<code><![CDATA[$GLOBALS['csv_escaped']]]></code>
6770-
<code><![CDATA[$GLOBALS['csv_terminated']]]></code>
6771-
<code><![CDATA[$GLOBALS['csv_terminated']]]></code>
6772-
</PossiblyNullOperand>
6773-
<RedundantCondition>
6774-
<code><![CDATA[$GLOBALS['csv_removeCRLF']]]></code>
6775-
<code><![CDATA[isset($GLOBALS['csv_removeCRLF']) && $GLOBALS['csv_removeCRLF']]]></code>
6776-
</RedundantCondition>
6777-
<RiskyTruthyFalsyComparison>
6778-
<code><![CDATA[empty($GLOBALS['csv_terminated'])]]></code>
6779-
</RiskyTruthyFalsyComparison>
67806736
</file>
67816737
<file src="src/Plugins/Export/ExportExcel.php">
67826738
<DeprecatedMethod>

psalm.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@
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,

src/Controllers/Export/ExportController.php

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -489,37 +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['csv_separator'])) {
497-
$GLOBALS['csv_separator'] = $postParams['csv_separator'];
498-
}
499-
500-
if (isset($postParams['csv_enclosed'])) {
501-
$GLOBALS['csv_enclosed'] = $postParams['csv_enclosed'];
502-
}
503-
504-
if (isset($postParams['csv_escaped'])) {
505-
$GLOBALS['csv_escaped'] = $postParams['csv_escaped'];
506-
}
507-
508-
if (isset($postParams['csv_terminated'])) {
509-
$GLOBALS['csv_terminated'] = $postParams['csv_terminated'];
510-
}
511-
512-
if (isset($postParams['csv_null'])) {
513-
$GLOBALS['csv_null'] = $postParams['csv_null'];
514-
}
515-
516-
if (isset($postParams['csv_removeCRLF'])) {
517-
$GLOBALS['csv_removeCRLF'] = $postParams['csv_removeCRLF'];
518-
}
519-
520-
// phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed
521-
if (isset($postParams['csv_columns'])) {
522-
$GLOBALS['csv_columns'] = $postParams['csv_columns'];
523-
}
496+
$GLOBALS['xkana'] = $postParams['xkana'];
524497
}
525498
}

0 commit comments

Comments
 (0)