Skip to content

Commit fe519c5

Browse files
vlradstakeMacFJA
authored andcommitted
Return empty modules array when module command is not available
1 parent 6bf7ed5 commit fe519c5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Redis/Initializer.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,14 @@ public static function registerCommandsRediska(): void
139139

140140
public static function getRediSearchVersion(Client $client): ?string
141141
{
142-
$modules = $client->executeRaw('module', 'list') ?? [];
142+
try {
143+
$modules = $client->executeRaw('module', 'list') ?? [];
144+
} catch (\Throwable $exception) {
145+
if (strpos($exception->getMessage(), 'unknown command') === false) {
146+
throw $exception;
147+
}
148+
$modules = [];
149+
}
143150

144151
foreach ($modules as $module) {
145152
$data = array_column(

0 commit comments

Comments
 (0)