Skip to content

Commit 747ac5f

Browse files
kamil-tekielaMauricioFauth
authored andcommitted
Drop $GLOBALS['error_message']
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 2874235 commit 747ac5f

6 files changed

Lines changed: 21 additions & 35 deletions

File tree

phpstan-baseline.neon

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7399,11 +7399,6 @@ parameters:
73997399
count: 1
74007400
path: src/Http/Middleware/StatementHistory.php
74017401

7402-
-
7403-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
7404-
count: 1
7405-
path: src/Http/Middleware/StatementHistory.php
7406-
74077402
-
74087403
message: "#^Parameter \\#4 \\$sqlquery of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:setHistory\\(\\) expects string, mixed given\\.$#"
74097404
count: 1
@@ -11641,7 +11636,7 @@ parameters:
1164111636

1164211637
-
1164311638
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
11644-
count: 4
11639+
count: 3
1164511640
path: src/ResponseRenderer.php
1164611641

1164711642
-

psalm-baseline.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6105,9 +6105,6 @@
61056105
<MixedArgument>
61066106
<code><![CDATA[$GLOBALS['sql_query']]]></code>
61076107
</MixedArgument>
6108-
<RiskyTruthyFalsyComparison>
6109-
<code><![CDATA[empty($GLOBALS['error_message'])]]></code>
6110-
</RiskyTruthyFalsyComparison>
61116108
</file>
61126109
<file src="src/Http/Middleware/TokenRequestParamChecking.php">
61136110
<MixedArgument>
@@ -9630,7 +9627,6 @@
96309627
<code><![CDATA[$value]]></code>
96319628
</MixedAssignment>
96329629
<RiskyTruthyFalsyComparison>
9633-
<code><![CDATA[empty($GLOBALS['error_message'])]]></code>
96349630
<code><![CDATA[empty($_REQUEST['no_debug'])]]></code>
96359631
</RiskyTruthyFalsyComparison>
96369632
</file>

psalm.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
display_query: string,
5858
errno: int,
5959
error: bool,
60-
error_message: string,
6160
excel_edition: 'win'|'mac_excel2003'|'mac_excel2008',
6261
file_handle: resource|null,
6362
finished: bool,

src/Http/Middleware/StatementHistory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
3737

3838
if (
3939
! $request->has('no_history')
40-
&& empty($GLOBALS['error_message'])
4140
&& $GLOBALS['sql_query'] !== ''
4241
&& $this->dbi->isConnected()
4342
) {

src/ResponseRenderer.php

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -293,29 +293,27 @@ private function ajaxResponse(): string
293293
$promptPhpErrors = $this->errorHandler->hasErrorsForPrompt();
294294
$this->addJSON('promptPhpErrors', $promptPhpErrors);
295295

296-
if (empty($GLOBALS['error_message'])) {
297-
// set current db, table and sql query in the querywindow
298-
// (this is for the bottom console)
299-
$query = '';
300-
$maxChars = $this->config->settings['MaxCharactersInDisplayedSQL'];
301-
if (isset($GLOBALS['sql_query']) && mb_strlen($GLOBALS['sql_query']) < $maxChars) {
302-
$query = $GLOBALS['sql_query'];
303-
}
304-
305-
$this->addJSON(
306-
'reloadQuerywindow',
307-
['db' => Current::$database, 'table' => Current::$table, 'sql_query' => $query],
308-
);
309-
if (! empty($GLOBALS['focus_querywindow'])) {
310-
$this->addJSON('_focusQuerywindow', $query);
311-
}
312-
313-
if (! empty($GLOBALS['reload'])) {
314-
$this->addJSON('reloadNavigation', 1);
315-
}
316-
317-
$this->addJSON('params', $this->getHeader()->getJsParams());
296+
// set current db, table and sql query in the querywindow
297+
// (this is for the bottom console)
298+
$query = '';
299+
$maxChars = $this->config->settings['MaxCharactersInDisplayedSQL'];
300+
if (isset($GLOBALS['sql_query']) && mb_strlen($GLOBALS['sql_query']) < $maxChars) {
301+
$query = $GLOBALS['sql_query'];
318302
}
303+
304+
$this->addJSON(
305+
'reloadQuerywindow',
306+
['db' => Current::$database, 'table' => Current::$table, 'sql_query' => $query],
307+
);
308+
if (! empty($GLOBALS['focus_querywindow'])) {
309+
$this->addJSON('_focusQuerywindow', $query);
310+
}
311+
312+
if (! empty($GLOBALS['reload'])) {
313+
$this->addJSON('reloadNavigation', 1);
314+
}
315+
316+
$this->addJSON('params', $this->getHeader()->getJsParams());
319317
}
320318

321319
$result = json_encode($this->JSON);

tests/unit/FooterTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ protected function setUp(): void
4646
$_GET['reload_left_frame'] = '1';
4747
$GLOBALS['focus_querywindow'] = 'main_pane_left';
4848
$this->object = new Footer(new Template(), $config);
49-
unset($GLOBALS['error_message']);
5049
unset($GLOBALS['sql_query']);
5150
$_POST = [];
5251
}

0 commit comments

Comments
 (0)