Skip to content

Commit c2f341a

Browse files
authored
Merge pull request #8173 from kenjis/fix-ShowTableInfo-promptByKey
fix: Undefined array key error in `spark db:table`
2 parents a859ba0 + eb908d1 commit c2f341a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

system/Commands/Database/ShowTableInfo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ public function run(array $params)
125125
$limitRows = (int) ($params['limit-rows'] ?? 10);
126126
$limitFieldValue = (int) ($params['limit-field-value'] ?? 15);
127127

128-
if (! in_array($tableName, $tables, true)) {
128+
while (! in_array($tableName, $tables, true)) {
129129
$tableNameNo = CLI::promptByKey(
130130
['Here is the list of your database tables:', 'Which table do you want to see?'],
131131
$tables,
132132
'required'
133133
);
134134
CLI::newLine();
135135

136-
$tableName = $tables[$tableNameNo];
136+
$tableName = $tables[$tableNameNo] ?? null;
137137
}
138138

139139
if (array_key_exists('metadata', $params)) {

0 commit comments

Comments
 (0)