From 475ac70837cce94932068d6491d01615ff12c5c4 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 4 Jun 2025 00:59:35 -0700 Subject: [PATCH] Fix installDependencies() to correctly handle packageList array --- src/RaspAP/Plugins/PluginInstaller.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/RaspAP/Plugins/PluginInstaller.php b/src/RaspAP/Plugins/PluginInstaller.php index 753b1b2f..3df0b067 100644 --- a/src/RaspAP/Plugins/PluginInstaller.php +++ b/src/RaspAP/Plugins/PluginInstaller.php @@ -269,10 +269,16 @@ class PluginInstaller */ private function installDependencies(array $dependencies): void { - $packages = array_keys($dependencies); - $packageList = implode(' ', $packages); + if (empty($dependencies)) { + return; // nothing to do + } - $cmd = sprintf('sudo %s packages %s', escapeshellarg($this->helperScriptPath), escapeshellarg($packageList)); + $packageList = implode(' ', array_map('escapeshellarg', array_keys($dependencies))); + $cmd = sprintf( + 'sudo %s packages %s', + escapeshellarg($this->helperScriptPath), + $packageList + ); $return = shell_exec($cmd); if (strpos(strtolower($return), 'ok') === false) { throw new \Exception('Plugin helper failed to install depedencies.');