Skip to content

Commit ddc64a4

Browse files
Merge pull request #19450 from kamil-tekiela/Removal-of-some-dead-GLOBALS
Removal of some dead globals
2 parents 7f5cd05 + 873a743 commit ddc64a4

20 files changed

+28
-161
lines changed

phpstan-baseline.neon

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3561,12 +3561,6 @@ parameters:
35613561
count: 1
35623562
path: src/Controllers/Server/DatabasesController.php
35633563

3564-
-
3565-
message: '#^Parameter \#1 \$tmpSelect of method PhpMyAdmin\\Export\\Options\:\:getDatabasesForSelectOptions\(\) expects string, mixed given\.$#'
3566-
identifier: argument.type
3567-
count: 1
3568-
path: src/Controllers/Server/ExportController.php
3569-
35703564
-
35713565
message: '#^Parameter \#5 \$numTables of method PhpMyAdmin\\Export\\Options\:\:getOptions\(\) expects int\|string, mixed given\.$#'
35723566
identifier: argument.type
@@ -11784,12 +11778,6 @@ parameters:
1178411778
count: 1
1178511779
path: src/Plugins/Auth/AuthenticationHttp.php
1178611780

11787-
-
11788-
message: '#^Property PhpMyAdmin\\Plugins\\AuthenticationPlugin\:\:\$user \(string\) does not accept mixed\.$#'
11789-
identifier: assign.propertyType
11790-
count: 1
11791-
path: src/Plugins/Auth/AuthenticationHttp.php
11792-
1179311781
-
1179411782
message: '''
1179511783
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
@@ -15606,7 +15594,7 @@ parameters:
1560615594
-
1560715595
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
1560815596
identifier: empty.notAllowed
15609-
count: 3
15597+
count: 2
1561015598
path: src/ResponseRenderer.php
1561115599

1561215600
-
@@ -17121,12 +17109,6 @@ parameters:
1712117109
count: 2
1712217110
path: src/Table/ColumnsDefinition.php
1712317111

17124-
-
17125-
message: '#^Cannot access offset mixed on mixed\.$#'
17126-
identifier: offsetAccess.nonOffsetAccessible
17127-
count: 2
17128-
path: src/Table/ColumnsDefinition.php
17129-
1713017112
-
1713117113
message: '#^Cannot cast mixed to string\.$#'
1713217114
identifier: cast.string
@@ -17181,12 +17163,6 @@ parameters:
1718117163
count: 1
1718217164
path: src/Table/ColumnsDefinition.php
1718317165

17184-
-
17185-
message: '#^Parameter \#1 \.\.\.\$arrays of function array_merge expects array, mixed given\.$#'
17186-
identifier: argument.type
17187-
count: 1
17188-
path: src/Table/ColumnsDefinition.php
17189-
1719017166
-
1719117167
message: '#^Parameter \#2 \$string of function explode expects string, mixed given\.$#'
1719217168
identifier: argument.type

psalm-baseline.xml

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,6 @@
16201620
<InvalidArrayOffset>
16211621
<code><![CDATA[$GLOBALS['language_stats']]]></code>
16221622
<code><![CDATA[$GLOBALS['language_stats']]]></code>
1623-
<code><![CDATA[$GLOBALS['show_query']]]></code>
16241623
</InvalidArrayOffset>
16251624
<MixedArgument>
16261625
<code><![CDATA[$this->config->get('ShowGitRevision') ?? true]]></code>
@@ -1635,9 +1634,6 @@
16351634
<MixedArrayTypeCoercion>
16361635
<code><![CDATA[$config->settings['Servers'][Current::$server]]]></code>
16371636
</MixedArrayTypeCoercion>
1638-
<MixedAssignment>
1639-
<code><![CDATA[$GLOBALS['show_query']]]></code>
1640-
</MixedAssignment>
16411637
<PossiblyNullArgument>
16421638
<code><![CDATA[$this->config->get('TempDir')]]></code>
16431639
</PossiblyNullArgument>
@@ -1944,12 +1940,6 @@
19441940
<DeprecatedMethod>
19451941
<code><![CDATA[Config::getInstance()]]></code>
19461942
</DeprecatedMethod>
1947-
<InvalidArrayOffset>
1948-
<code><![CDATA[$GLOBALS['hash']]]></code>
1949-
</InvalidArrayOffset>
1950-
<MixedAssignment>
1951-
<code><![CDATA[$GLOBALS['hash']]]></code>
1952-
</MixedAssignment>
19531943
<PossiblyUnusedMethod>
19541944
<code><![CDATA[__construct]]></code>
19551945
</PossiblyUnusedMethod>
@@ -1958,12 +1948,6 @@
19581948
<DeprecatedMethod>
19591949
<code><![CDATA[Config::getInstance()]]></code>
19601950
</DeprecatedMethod>
1961-
<InvalidArrayOffset>
1962-
<code><![CDATA[$GLOBALS['hash']]]></code>
1963-
</InvalidArrayOffset>
1964-
<MixedAssignment>
1965-
<code><![CDATA[$GLOBALS['hash']]]></code>
1966-
</MixedAssignment>
19671951
<PossiblyUnusedMethod>
19681952
<code><![CDATA[__construct]]></code>
19691953
</PossiblyUnusedMethod>
@@ -1972,12 +1956,6 @@
19721956
<DeprecatedMethod>
19731957
<code><![CDATA[Config::getInstance()]]></code>
19741958
</DeprecatedMethod>
1975-
<InvalidArrayOffset>
1976-
<code><![CDATA[$GLOBALS['hash']]]></code>
1977-
</InvalidArrayOffset>
1978-
<MixedAssignment>
1979-
<code><![CDATA[$GLOBALS['hash']]]></code>
1980-
</MixedAssignment>
19811959
<PossiblyUnusedMethod>
19821960
<code><![CDATA[__construct]]></code>
19831961
</PossiblyUnusedMethod>
@@ -1986,12 +1964,6 @@
19861964
<DeprecatedMethod>
19871965
<code><![CDATA[Config::getInstance()]]></code>
19881966
</DeprecatedMethod>
1989-
<InvalidArrayOffset>
1990-
<code><![CDATA[$GLOBALS['hash']]]></code>
1991-
</InvalidArrayOffset>
1992-
<MixedAssignment>
1993-
<code><![CDATA[$GLOBALS['hash']]]></code>
1994-
</MixedAssignment>
19951967
<PossiblyUnusedMethod>
19961968
<code><![CDATA[__construct]]></code>
19971969
</PossiblyUnusedMethod>
@@ -2053,12 +2025,6 @@
20532025
<DeprecatedMethod>
20542026
<code><![CDATA[Config::getInstance()]]></code>
20552027
</DeprecatedMethod>
2056-
<InvalidArrayOffset>
2057-
<code><![CDATA[$GLOBALS['hash']]]></code>
2058-
</InvalidArrayOffset>
2059-
<MixedAssignment>
2060-
<code><![CDATA[$GLOBALS['hash']]]></code>
2061-
</MixedAssignment>
20622028
<PossiblyUnusedMethod>
20632029
<code><![CDATA[__construct]]></code>
20642030
</PossiblyUnusedMethod>
@@ -2067,12 +2033,6 @@
20672033
<DeprecatedMethod>
20682034
<code><![CDATA[Config::getInstance()]]></code>
20692035
</DeprecatedMethod>
2070-
<InvalidArrayOffset>
2071-
<code><![CDATA[$GLOBALS['hash']]]></code>
2072-
</InvalidArrayOffset>
2073-
<MixedAssignment>
2074-
<code><![CDATA[$GLOBALS['hash']]]></code>
2075-
</MixedAssignment>
20762036
<PossiblyUnusedMethod>
20772037
<code><![CDATA[__construct]]></code>
20782038
</PossiblyUnusedMethod>
@@ -2183,21 +2143,15 @@
21832143
<file src="src/Controllers/Server/ExportController.php">
21842144
<InvalidArrayOffset>
21852145
<code><![CDATA[$GLOBALS['num_tables']]]></code>
2186-
<code><![CDATA[$GLOBALS['select_item']]]></code>
21872146
<code><![CDATA[$GLOBALS['single_table']]]></code>
2188-
<code><![CDATA[$GLOBALS['tmp_select']]]></code>
21892147
<code><![CDATA[$GLOBALS['unlim_num_rows']]]></code>
21902148
</InvalidArrayOffset>
21912149
<MixedArgument>
21922150
<code><![CDATA[$GLOBALS['num_tables']]]></code>
2193-
<code><![CDATA[$GLOBALS['select_item']]]></code>
21942151
<code><![CDATA[$GLOBALS['unlim_num_rows']]]></code>
21952152
</MixedArgument>
21962153
<MixedAssignment>
2197-
<code><![CDATA[$GLOBALS['select_item']]]></code>
2198-
<code><![CDATA[$GLOBALS['select_item']]]></code>
21992154
<code><![CDATA[$GLOBALS['single_table']]]></code>
2200-
<code><![CDATA[$GLOBALS['tmp_select']]]></code>
22012155
<code><![CDATA[$GLOBALS['unlim_num_rows']]]></code>
22022156
</MixedAssignment>
22032157
<PossiblyUnusedMethod>
@@ -3661,15 +3615,9 @@
36613615
<DeprecatedMethod>
36623616
<code><![CDATA[Config::getInstance()]]></code>
36633617
</DeprecatedMethod>
3664-
<InvalidArrayOffset>
3665-
<code><![CDATA[$GLOBALS['change_password_message']]]></code>
3666-
</InvalidArrayOffset>
36673618
<MixedArgument>
36683619
<code><![CDATA[$message->getDisplay()]]></code>
36693620
</MixedArgument>
3670-
<MixedAssignment>
3671-
<code><![CDATA[$GLOBALS['change_password_message']]]></code>
3672-
</MixedAssignment>
36733621
<MixedMethodCall>
36743622
<code><![CDATA[getDisplay]]></code>
36753623
</MixedMethodCall>
@@ -6902,14 +6850,9 @@
69026850
</DeprecatedMethod>
69036851
<InvalidArrayOffset>
69046852
<code><![CDATA[$GLOBALS['PHP_AUTH_PW']]]></code>
6905-
<code><![CDATA[$GLOBALS['PHP_AUTH_USER']]]></code>
69066853
</InvalidArrayOffset>
6907-
<MixedArgument>
6908-
<code><![CDATA[$this->user]]></code>
6909-
</MixedArgument>
69106854
<MixedAssignment>
69116855
<code><![CDATA[$this->password]]></code>
6912-
<code><![CDATA[$this->user]]></code>
69136856
</MixedAssignment>
69146857
<PossiblyInvalidArgument>
69156858
<code><![CDATA[$oldUser]]></code>
@@ -9205,7 +9148,6 @@
92059148
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
92069149
</DeprecatedMethod>
92079150
<InvalidArrayOffset>
9208-
<code><![CDATA[$GLOBALS['focus_querywindow']]]></code>
92099151
<code><![CDATA[$GLOBALS['reload']]]></code>
92109152
</InvalidArrayOffset>
92119153
<MixedArgumentTypeCoercion>
@@ -9970,11 +9912,7 @@
99709912
<DeprecatedMethod>
99719913
<code><![CDATA[Config::getInstance()]]></code>
99729914
</DeprecatedMethod>
9973-
<InvalidArrayOffset>
9974-
<code><![CDATA[$GLOBALS['mime_map']]]></code>
9975-
</InvalidArrayOffset>
99769915
<MixedArgument>
9977-
<code><![CDATA[$GLOBALS['mime_map'][$columnMeta['Field']] ?? []]]></code>
99789916
<code><![CDATA[$columnMeta['Default']]]></code>
99799917
<code><![CDATA[$columnMeta['DefaultValue']]]></code>
99809918
<code><![CDATA[$columnMeta['Field']]]></code>
@@ -9986,20 +9924,15 @@
99869924
<code><![CDATA[Util::getValueByKey($_POST, ['field_key', $columnNumber], '')]]></code>
99879925
</MixedArgument>
99889926
<MixedArrayAccess>
9989-
<code><![CDATA[$GLOBALS['mime_map'][$columnMeta['Field']]]]></code>
99909927
<code><![CDATA[$columnMeta['column_status']['isEditable']]]></code>
99919928
<code><![CDATA[$columnMeta['column_status']['isEditable']]]></code>
99929929
</MixedArrayAccess>
9993-
<MixedArrayAssignment>
9994-
<code><![CDATA[$GLOBALS['mime_map'][$columnMeta['Field']]]]></code>
9995-
</MixedArrayAssignment>
99969930
<MixedArrayOffset>
9997-
<code><![CDATA[$GLOBALS['mime_map'][$columnMeta['Field']]]]></code>
9998-
<code><![CDATA[$GLOBALS['mime_map'][$columnMeta['Field']]]]></code>
99999931
<code><![CDATA[$commentsMap[$columnMeta['Field']]]]></code>
9932+
<code><![CDATA[$mimeMap[$columnMeta['Field']]]]></code>
9933+
<code><![CDATA[$mimeMap[$columnMeta['Field']]]]></code>
100009934
</MixedArrayOffset>
100019935
<MixedAssignment>
10002-
<code><![CDATA[$GLOBALS['mime_map']]]></code>
100039936
<code><![CDATA[$columnMeta['Default']]]></code>
100049937
<code><![CDATA[$columnMeta['Expression']]]></code>
100059938
<code><![CDATA[$commentsMap[$columnMeta['Field']]]]></code>

src/Controllers/HomeController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public function __invoke(ServerRequest $request): Response
6666
}
6767

6868
$GLOBALS['message'] ??= null;
69-
$GLOBALS['show_query'] ??= null;
7069

7170
if ($request->isAjax() && ! empty($_REQUEST['access_time'])) {
7271
return $this->response->response();
@@ -79,7 +78,6 @@ public function __invoke(ServerRequest $request): Response
7978
// The DB is defined here and sent to the JS front-end to refresh the DB tree
8079
Current::$database = $request->getParsedBodyParamAsString('db', '');
8180
Current::$table = '';
82-
$GLOBALS['show_query'] = '1';
8381

8482
if (Current::$server > 0 && $this->dbi->isSuperUser()) {
8583
$this->dbi->selectDb('mysql');

src/Controllers/Preferences/ExportController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function __construct(
3636
public function __invoke(ServerRequest $request): Response
3737
{
3838
$GLOBALS['error'] ??= null;
39-
$GLOBALS['hash'] ??= null;
4039

4140
$configFile = new ConfigFile($this->config->baseSettings);
4241
$this->userPreferences->pageInit($configFile);
@@ -62,8 +61,8 @@ public function __invoke(ServerRequest $request): Response
6261
if ($result === true) {
6362
// reload config
6463
$this->config->loadUserPreferences($this->themeManager);
65-
$GLOBALS['hash'] = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
66-
$this->userPreferences->redirect('index.php?route=/preferences/export', null, $GLOBALS['hash']);
64+
$hash = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
65+
$this->userPreferences->redirect('index.php?route=/preferences/export', null, $hash);
6766

6867
return $this->response->response();
6968
}

src/Controllers/Preferences/FeaturesController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function __construct(
3636
public function __invoke(ServerRequest $request): Response
3737
{
3838
$GLOBALS['error'] ??= null;
39-
$GLOBALS['hash'] ??= null;
4039

4140
$configFile = new ConfigFile($this->config->baseSettings);
4241
$this->userPreferences->pageInit($configFile);
@@ -62,8 +61,8 @@ public function __invoke(ServerRequest $request): Response
6261
if ($result === true) {
6362
// reload config
6463
$this->config->loadUserPreferences($this->themeManager);
65-
$GLOBALS['hash'] = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
66-
$this->userPreferences->redirect('index.php?route=/preferences/features', null, $GLOBALS['hash']);
64+
$hash = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
65+
$this->userPreferences->redirect('index.php?route=/preferences/features', null, $hash);
6766

6867
return $this->response->response();
6968
}

src/Controllers/Preferences/ImportController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function __construct(
3636
public function __invoke(ServerRequest $request): Response
3737
{
3838
$GLOBALS['error'] ??= null;
39-
$GLOBALS['hash'] ??= null;
4039

4140
$configFile = new ConfigFile($this->config->baseSettings);
4241
$this->userPreferences->pageInit($configFile);
@@ -62,8 +61,8 @@ public function __invoke(ServerRequest $request): Response
6261
if ($result === true) {
6362
// reload config
6463
$this->config->loadUserPreferences($this->themeManager);
65-
$GLOBALS['hash'] = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
66-
$this->userPreferences->redirect('index.php?route=/preferences/import', null, $GLOBALS['hash']);
64+
$hash = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
65+
$this->userPreferences->redirect('index.php?route=/preferences/import', null, $hash);
6766

6867
return $this->response->response();
6968
}

src/Controllers/Preferences/MainPanelController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function __construct(
3636
public function __invoke(ServerRequest $request): Response
3737
{
3838
$GLOBALS['error'] ??= null;
39-
$GLOBALS['hash'] ??= null;
4039

4140
$configFile = new ConfigFile($this->config->baseSettings);
4241
$this->userPreferences->pageInit($configFile);
@@ -62,8 +61,8 @@ public function __invoke(ServerRequest $request): Response
6261
if ($result === true) {
6362
// reload config
6463
$this->config->loadUserPreferences($this->themeManager);
65-
$GLOBALS['hash'] = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
66-
$this->userPreferences->redirect('index.php?route=/preferences/main-panel', null, $GLOBALS['hash']);
64+
$hash = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
65+
$this->userPreferences->redirect('index.php?route=/preferences/main-panel', null, $hash);
6766

6867
return $this->response->response();
6968
}

src/Controllers/Preferences/NavigationController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function __construct(
3636
public function __invoke(ServerRequest $request): Response
3737
{
3838
$GLOBALS['error'] ??= null;
39-
$GLOBALS['hash'] ??= null;
4039

4140
$configFile = new ConfigFile($this->config->baseSettings);
4241
$this->userPreferences->pageInit($configFile);
@@ -62,8 +61,8 @@ public function __invoke(ServerRequest $request): Response
6261
if ($result === true) {
6362
// reload config
6463
$this->config->loadUserPreferences($this->themeManager);
65-
$GLOBALS['hash'] = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
66-
$this->userPreferences->redirect('index.php?route=/preferences/navigation', null, $GLOBALS['hash']);
64+
$hash = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
65+
$this->userPreferences->redirect('index.php?route=/preferences/navigation', null, $hash);
6766

6867
return $this->response->response();
6968
}

src/Controllers/Preferences/SqlController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function __construct(
3636
public function __invoke(ServerRequest $request): Response
3737
{
3838
$GLOBALS['error'] ??= null;
39-
$GLOBALS['hash'] ??= null;
4039

4140
$configFile = new ConfigFile($this->config->baseSettings);
4241
$this->userPreferences->pageInit($configFile);
@@ -62,8 +61,8 @@ public function __invoke(ServerRequest $request): Response
6261
if ($result === true) {
6362
// reload config
6463
$this->config->loadUserPreferences($this->themeManager);
65-
$GLOBALS['hash'] = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
66-
$this->userPreferences->redirect('index.php?route=/preferences/sql', null, $GLOBALS['hash']);
64+
$hash = ltrim($request->getParsedBodyParamAsString('tab_hash'), '#');
65+
$this->userPreferences->redirect('index.php?route=/preferences/sql', null, $hash);
6766

6867
return $this->response->response();
6968
}

0 commit comments

Comments
 (0)