Skip to content

Commit e4652bc

Browse files
Replace $db and $table with DatabaseName and TableName (#17790)
Signed-off-by: Arpit Gulgulia <arpitgulgulia@gmail.com>
1 parent 1bf0abd commit e4652bc

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

libraries/classes/Controllers/Normalization/AddNewPrimaryController.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
namespace PhpMyAdmin\Controllers\Normalization;
66

77
use PhpMyAdmin\Controllers\AbstractController;
8+
use PhpMyAdmin\Dbal\DatabaseName;
9+
use PhpMyAdmin\Dbal\TableName;
810
use PhpMyAdmin\Http\ServerRequest;
911
use PhpMyAdmin\Normalization;
1012
use PhpMyAdmin\ResponseRenderer;
@@ -25,17 +27,23 @@ public function __construct(ResponseRenderer $response, Template $template, Norm
2527
public function __invoke(ServerRequest $request): void
2628
{
2729
$num_fields = 1;
30+
31+
$db = DatabaseName::tryFromValue($GLOBALS['db']);
32+
$table = TableName::tryFromValue($GLOBALS['table']);
33+
$dbName = isset($db) ? $db->getName() : '';
34+
$tableName = isset($table) ? $table->getName() : '';
35+
2836
$columnMeta = [
29-
'Field' => $GLOBALS['table'] . '_id',
37+
'Field' => $tableName . '_id',
3038
'Extra' => 'auto_increment',
3139
];
3240
$html = $this->normalization->getHtmlForCreateNewColumn(
3341
$num_fields,
34-
$GLOBALS['db'],
35-
$GLOBALS['table'],
42+
$dbName,
43+
$tableName,
3644
$columnMeta
3745
);
38-
$html .= Url::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
46+
$html .= Url::getHiddenInputs($dbName, $tableName);
3947
$this->response->addHTML($html);
4048
}
4149
}

0 commit comments

Comments
 (0)