From ef9b507572c7b2b26a469d14ed81271d147c985b Mon Sep 17 00:00:00 2001 From: Evgeniy Zverev Date: Thu, 1 Feb 2024 19:35:12 +0200 Subject: [PATCH 1/7] Add a check for the presence of the parameter for the `bin/magento downloadable:domains:add` --- .../Console/Command/DomainsAddCommand.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php index 7155adeadaf09..eeb772fb5cd8a 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php @@ -69,19 +69,23 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { try { - if ($input->getArgument(self::INPUT_KEY_DOMAINS)) { - $whitelistBefore = $this->domainManager->getDomains(); - $newDomains = $input->getArgument(self::INPUT_KEY_DOMAINS); - $newDomains = array_filter(array_map('trim', $newDomains), 'strlen'); + $domains = $input->getArgument(self::INPUT_KEY_DOMAINS); - $this->domainManager->addDomains($newDomains); + if (empty($domains)) { + throw new \InvalidArgumentException('Error: Domains parameter is missing.'); + } + + $whitelistBefore = $this->domainManager->getDomains(); + $newDomains = array_filter(array_map('trim', $domains), 'strlen'); + + $this->domainManager->addDomains($newDomains); - foreach (array_diff($this->domainManager->getDomains(), $whitelistBefore) as $newHost) { - $output->writeln( - $newHost . ' was added to the whitelist.' . PHP_EOL - ); - } + foreach (array_diff($this->domainManager->getDomains(), $whitelistBefore) as $newHost) { + $output->writeln($newHost . ' was added to the whitelist.' . PHP_EOL); } + } catch (\InvalidArgumentException $e) { + $output->writeln('' . $e->getMessage() . ''); + return Cli::RETURN_FAILURE; } catch (Exception $e) { $output->writeln('' . $e->getMessage() . ''); if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { From d7a9660f4a06570bac42f97dd7e6e2ac89632f9a Mon Sep 17 00:00:00 2001 From: Evgeniy Zverev Date: Thu, 1 Feb 2024 19:35:56 +0200 Subject: [PATCH 2/7] Add a check for the presence of the parameter for the `bin/magento downloadable:domains:remove` --- .../Console/Command/DomainsRemoveCommand.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php index d3acb8e4ae75a..7fc113eb2a7f2 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php @@ -70,18 +70,22 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { try { - if ($input->getArgument(self::INPUT_KEY_DOMAINS)) { - $whitelistBefore = $this->domainManager->getDomains(); - $removeDomains = $input->getArgument(self::INPUT_KEY_DOMAINS); - $removeDomains = array_filter(array_map('trim', $removeDomains), 'strlen'); - $this->domainManager->removeDomains($removeDomains); + $domains = $input->getArgument(self::INPUT_KEY_DOMAINS); - foreach (array_diff($whitelistBefore, $this->domainManager->getDomains()) as $removedHost) { - $output->writeln( - $removedHost . ' was removed from the whitelist.' - ); - } + if (empty($domains)) { + throw new \InvalidArgumentException('Error: Domains parameter is missing.'); } + + $whitelistBefore = $this->domainManager->getDomains(); + $removeDomains = array_filter(array_map('trim', $domains), 'strlen'); + $this->domainManager->removeDomains($removeDomains); + + foreach (array_diff($whitelistBefore, $this->domainManager->getDomains()) as $removedHost) { + $output->writeln($removedHost . ' was removed from the whitelist.'); + } + } catch (\InvalidArgumentException $e) { + $output->writeln('' . $e->getMessage() . ''); + return Cli::RETURN_FAILURE; } catch (Exception $e) { $output->writeln('' . $e->getMessage() . ''); if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { From 89162df27f24e1bfbae28b96c5123d63b033e22b Mon Sep 17 00:00:00 2001 From: Evgeniy Zverev Date: Sun, 11 Feb 2024 12:10:28 +0200 Subject: [PATCH 3/7] Fix static tests --- .../Console/Command/DomainsAddCommand.php | 22 ++++++++++--- .../Console/Command/DomainsRemoveCommand.php | 31 +++++++++++++------ 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php index eeb772fb5cd8a..021e788d5e4d2 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php @@ -87,13 +87,25 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln('' . $e->getMessage() . ''); return Cli::RETURN_FAILURE; } catch (Exception $e) { - $output->writeln('' . $e->getMessage() . ''); - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $output->writeln($e->getTraceAsString()); - } - return Cli::RETURN_FAILURE; + return $this->handleException($e, $output); } return Cli::RETURN_SUCCESS; } + + /** + * Handle any exception thrown during command execution. + * + * @param Exception $e + * @param OutputInterface $output + * @return int + */ + protected function handleException(Exception $e, OutputInterface $output): int + { + $output->writeln('' . $e->getMessage() . ''); + if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $output->writeln($e->getTraceAsString()); + } + return Cli::RETURN_FAILURE; + } } diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php index 7fc113eb2a7f2..f709d2172b9c6 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php @@ -77,23 +77,36 @@ protected function execute(InputInterface $input, OutputInterface $output) } $whitelistBefore = $this->domainManager->getDomains(); - $removeDomains = array_filter(array_map('trim', $domains), 'strlen'); - $this->domainManager->removeDomains($removeDomains); + $removedDomains = array_filter(array_map('trim', $domains), 'strlen'); - foreach (array_diff($whitelistBefore, $this->domainManager->getDomains()) as $removedHost) { - $output->writeln($removedHost . ' was removed from the whitelist.'); + $this->domainManager->removeDomains($removedDomains); + + foreach (array_intersect($removedDomains, $whitelistBefore) as $removedHost) { + $output->writeln($removedHost . ' was removed from the whitelist.' . PHP_EOL); } } catch (\InvalidArgumentException $e) { $output->writeln('' . $e->getMessage() . ''); return Cli::RETURN_FAILURE; } catch (Exception $e) { - $output->writeln('' . $e->getMessage() . ''); - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $output->writeln($e->getTraceAsString()); - } - return Cli::RETURN_FAILURE; + return $this->handleException($e, $output); } return Cli::RETURN_SUCCESS; } + + /** + * Handle any exception thrown during command execution. + * + * @param Exception $e + * @param OutputInterface $output + * @return int + */ + protected function handleException(Exception $e, OutputInterface $output): int + { + $output->writeln('' . $e->getMessage() . ''); + if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $output->writeln($e->getTraceAsString()); + } + return Cli::RETURN_FAILURE; + } } From 8cbd20469dfa9554c59fce2d25855e6761c74c40 Mon Sep 17 00:00:00 2001 From: Evgeniy Zverev Date: Sun, 11 Feb 2024 13:14:02 +0200 Subject: [PATCH 4/7] Fix static tests --- .../Console/Command/DomainsAddCommand.php | 37 ++++++++++++--- .../Console/Command/DomainsRemoveCommand.php | 46 ++++++++++++++----- 2 files changed, 64 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php index 021e788d5e4d2..cc45ba48a8c8a 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php @@ -71,9 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $domains = $input->getArgument(self::INPUT_KEY_DOMAINS); - if (empty($domains)) { - throw new \InvalidArgumentException('Error: Domains parameter is missing.'); - } + $this->validateDomains($domains); $whitelistBefore = $this->domainManager->getDomains(); $newDomains = array_filter(array_map('trim', $domains), 'strlen'); @@ -83,18 +81,43 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach (array_diff($this->domainManager->getDomains(), $whitelistBefore) as $newHost) { $output->writeln($newHost . ' was added to the whitelist.' . PHP_EOL); } + + return Cli::RETURN_SUCCESS; } catch (\InvalidArgumentException $e) { - $output->writeln('' . $e->getMessage() . ''); - return Cli::RETURN_FAILURE; + return $this->handleInvalidArgumentException($e, $output); } catch (Exception $e) { return $this->handleException($e, $output); } + } + + /** + * Validate the input domains array + * + * @param array $domains + * @return void + */ + protected function validateDomains(array $domains) + { + if (empty($domains)) { + throw new \InvalidArgumentException('Error: Domains parameter is missing.'); + } + } - return Cli::RETURN_SUCCESS; + /** + * Handle the \InvalidArgumentException exception. + * + * @param \InvalidArgumentException $e + * @param OutputInterface $output + * @return int + */ + protected function handleInvalidArgumentException(\InvalidArgumentException $e, OutputInterface $output): int + { + $output->writeln('' . $e->getMessage() . ''); + return Cli::RETURN_FAILURE; } /** - * Handle any exception thrown during command execution. + * Handle any exception thrown during command execution * * @param Exception $e * @param OutputInterface $output diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php index f709d2172b9c6..89210c39fe2c2 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php @@ -72,9 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $domains = $input->getArgument(self::INPUT_KEY_DOMAINS); - if (empty($domains)) { - throw new \InvalidArgumentException('Error: Domains parameter is missing.'); - } + $this->validateDomains($domains); $whitelistBefore = $this->domainManager->getDomains(); $removedDomains = array_filter(array_map('trim', $domains), 'strlen'); @@ -84,29 +82,53 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach (array_intersect($removedDomains, $whitelistBefore) as $removedHost) { $output->writeln($removedHost . ' was removed from the whitelist.' . PHP_EOL); } + + return Cli::RETURN_SUCCESS; } catch (\InvalidArgumentException $e) { - $output->writeln('' . $e->getMessage() . ''); - return Cli::RETURN_FAILURE; + return $this->handleInvalidArgumentException($e, $output); } catch (Exception $e) { return $this->handleException($e, $output); } + } - return Cli::RETURN_SUCCESS; + /** + * Validate the input domains array + * + * @param array $domains + * @return void + */ + protected function validateDomains(array $domains) + { + if (empty($domains)) { + throw new \InvalidArgumentException('Error: Domains parameter is missing.'); + } } /** - * Handle any exception thrown during command execution. + * Handle the \InvalidArgumentException exception. * - * @param Exception $e + * @param \InvalidArgumentException $e * @param OutputInterface $output * @return int */ - protected function handleException(Exception $e, OutputInterface $output): int + protected function handleInvalidArgumentException(\InvalidArgumentException $e, OutputInterface $output): int { $output->writeln('' . $e->getMessage() . ''); - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $output->writeln($e->getTraceAsString()); - } return Cli::RETURN_FAILURE; } + + /** + * Handle any other exception thrown during command execution + * @param Exception $e + * @param OutputInterface $output + * @return int + */ + protected function handleException(Exception $e, OutputInterface $output): int + { + $output->writeln('' . $e->getMessage() . ''); + if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $output->writeln($e->getTraceAsString()); + } + return Cli::RETURN_FAILURE; + } } From 2ef4f65e937207cd04b3eecf85508743881c9a3d Mon Sep 17 00:00:00 2001 From: Evgeniy Zverev Date: Sun, 11 Feb 2024 17:42:44 +0200 Subject: [PATCH 5/7] Refactored the DomainsAddCommand and DomainsRemoveCommand classes to use the DownloadManager class instead of static methods to fix static tests --- .../Console/Command/DomainsAddCommand.php | 62 +++++-------------- .../Console/Command/DomainsRemoveCommand.php | 61 +++++------------- .../Magento/Downloadable/Helper/Download.php | 54 +++++++++++++++- 3 files changed, 81 insertions(+), 96 deletions(-) diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php index cc45ba48a8c8a..b7abf27a92c52 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php @@ -7,12 +7,14 @@ namespace Magento\Downloadable\Console\Command; use Exception; +use InvalidArgumentException; use Magento\Downloadable\Api\DomainManagerInterface as DomainManager; use Magento\Framework\Console\Cli; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Magento\Downloadable\Helper\Download as DownloadManager; /** * Class DomainsAddCommand @@ -31,14 +33,22 @@ class DomainsAddCommand extends Command */ private $domainManager; + /** + * @var DownloadManager + */ + private $downloadManager; + /** * DomainsAddCommand constructor. * @param DomainManager $domainManager + * @param DownloadManager $downloadManager */ public function __construct( - DomainManager $domainManager + DomainManager $domainManager, + DownloadManager $downloadManager ) { $this->domainManager = $domainManager; + $this->downloadManager = $downloadManager; parent::__construct(); } @@ -71,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $domains = $input->getArgument(self::INPUT_KEY_DOMAINS); - $this->validateDomains($domains); + $this->downloadManager->validateDomains($domains); $whitelistBefore = $this->domainManager->getDomains(); $newDomains = array_filter(array_map('trim', $domains), 'strlen'); @@ -83,52 +93,10 @@ protected function execute(InputInterface $input, OutputInterface $output) } return Cli::RETURN_SUCCESS; - } catch (\InvalidArgumentException $e) { - return $this->handleInvalidArgumentException($e, $output); + } catch (InvalidArgumentException $e) { + return $this->downloadManager->handleInvalidArgumentException($e, $output); } catch (Exception $e) { - return $this->handleException($e, $output); - } - } - - /** - * Validate the input domains array - * - * @param array $domains - * @return void - */ - protected function validateDomains(array $domains) - { - if (empty($domains)) { - throw new \InvalidArgumentException('Error: Domains parameter is missing.'); - } - } - - /** - * Handle the \InvalidArgumentException exception. - * - * @param \InvalidArgumentException $e - * @param OutputInterface $output - * @return int - */ - protected function handleInvalidArgumentException(\InvalidArgumentException $e, OutputInterface $output): int - { - $output->writeln('' . $e->getMessage() . ''); - return Cli::RETURN_FAILURE; - } - - /** - * Handle any exception thrown during command execution - * - * @param Exception $e - * @param OutputInterface $output - * @return int - */ - protected function handleException(Exception $e, OutputInterface $output): int - { - $output->writeln('' . $e->getMessage() . ''); - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $output->writeln($e->getTraceAsString()); + return $this->downloadManager->handleException($e, $output); } - return Cli::RETURN_FAILURE; } } diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php index 89210c39fe2c2..e60d4c1af80e3 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsRemoveCommand.php @@ -7,12 +7,14 @@ namespace Magento\Downloadable\Console\Command; use Exception; +use InvalidArgumentException; use Magento\Downloadable\Api\DomainManagerInterface as DomainManager; use Magento\Framework\Console\Cli; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Magento\Downloadable\Helper\Download as DownloadManager; /** * Class DomainsRemoveCommand @@ -31,15 +33,23 @@ class DomainsRemoveCommand extends Command */ private $domainManager; + /** + * @var DownloadManager + */ + private $downloadManager; + /** * DomainsRemoveCommand constructor. * * @param DomainManager $domainManager + * @param DownloadManager $downloadManager */ public function __construct( - DomainManager $domainManager + DomainManager $domainManager, + DownloadManager $downloadManager ) { $this->domainManager = $domainManager; + $this->downloadManager = $downloadManager; parent::__construct(); } @@ -72,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $domains = $input->getArgument(self::INPUT_KEY_DOMAINS); - $this->validateDomains($domains); + $this->downloadManager->validateDomains($domains); $whitelistBefore = $this->domainManager->getDomains(); $removedDomains = array_filter(array_map('trim', $domains), 'strlen'); @@ -84,51 +94,10 @@ protected function execute(InputInterface $input, OutputInterface $output) } return Cli::RETURN_SUCCESS; - } catch (\InvalidArgumentException $e) { - return $this->handleInvalidArgumentException($e, $output); + } catch (InvalidArgumentException $e) { + return $this->downloadManager->handleInvalidArgumentException($e, $output); } catch (Exception $e) { - return $this->handleException($e, $output); - } - } - - /** - * Validate the input domains array - * - * @param array $domains - * @return void - */ - protected function validateDomains(array $domains) - { - if (empty($domains)) { - throw new \InvalidArgumentException('Error: Domains parameter is missing.'); + return $this->downloadManager->handleException($e, $output); } } - - /** - * Handle the \InvalidArgumentException exception. - * - * @param \InvalidArgumentException $e - * @param OutputInterface $output - * @return int - */ - protected function handleInvalidArgumentException(\InvalidArgumentException $e, OutputInterface $output): int - { - $output->writeln('' . $e->getMessage() . ''); - return Cli::RETURN_FAILURE; - } - - /** - * Handle any other exception thrown during command execution - * @param Exception $e - * @param OutputInterface $output - * @return int - */ - protected function handleException(Exception $e, OutputInterface $output): int - { - $output->writeln('' . $e->getMessage() . ''); - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { - $output->writeln($e->getTraceAsString()); - } - return Cli::RETURN_FAILURE; - } } diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index ce2ff2c7117ab..5e8ba83df2f60 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -6,11 +6,16 @@ namespace Magento\Downloadable\Helper; +use Exception; +use InvalidArgumentException; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; use Magento\Framework\File\Mime; use Magento\Framework\Filesystem; use Magento\Framework\Exception\LocalizedException as CoreException; +use Symfony\Component\Console\Output\OutputInterface; +use Magento\Framework\Console\Cli; + /** * Downloadable Products Download Helper @@ -141,7 +146,7 @@ public function __construct( * Retrieve Resource file handle (socket, file pointer etc) * * @return \Magento\Framework\Filesystem\File\ReadInterface - * @throws CoreException|\Exception + * @throws CoreException|Exception */ protected function _getHandle() { @@ -243,14 +248,14 @@ public function getFilename() * @param string $resourceFile * @param string $linkType * @return $this - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function setResource($resourceFile, $linkType = self::LINK_TYPE_FILE) { if (self::LINK_TYPE_FILE == $linkType) { //check LFI protection if ($resourceFile && preg_match('#\.\.[\\\/]#', $resourceFile)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Requested file may not include parent directory traversal ("../", "..\\" notation)' ); } @@ -304,4 +309,47 @@ public function getContentDisposition($store = null) $store ); } + + /** + * Handle any exception thrown during command execution + * + * @param Exception $e + * @param OutputInterface $output + * @return int + */ + public static function handleException(Exception $e, OutputInterface $output): int + { + $output->writeln('' . $e->getMessage() . ''); + if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + $output->writeln($e->getTraceAsString()); + } + return Cli::RETURN_FAILURE; + } + + /** + * Validate the input domains array + * + * @param array $domains + * @return void + * @throws InvalidArgumentException + */ + public static function validateDomains(array $domains): void + { + if (empty($domains)) { + throw new InvalidArgumentException('Error: Domains parameter is missing.'); + } + } + + /** + * Handle the \InvalidArgumentException exception. + * + * @param InvalidArgumentException $e + * @param OutputInterface $output + * @return int + */ + public function handleInvalidArgumentException(InvalidArgumentException $e, OutputInterface $output): int + { + $output->writeln('' . $e->getMessage() . ''); + return Cli::RETURN_FAILURE; + } } From c8b1bbb2d022571de5d5cb5aa49914d16963f784 Mon Sep 17 00:00:00 2001 From: Evgeniy Zverev Date: Sun, 11 Feb 2024 18:46:57 +0200 Subject: [PATCH 6/7] Fix static tests --- app/code/Magento/Downloadable/Helper/Download.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index 5e8ba83df2f60..4f3b080c822d9 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -16,7 +16,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Magento\Framework\Console\Cli; - /** * Downloadable Products Download Helper * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -317,7 +316,7 @@ public function getContentDisposition($store = null) * @param OutputInterface $output * @return int */ - public static function handleException(Exception $e, OutputInterface $output): int + public function handleException(Exception $e, OutputInterface $output): int { $output->writeln('' . $e->getMessage() . ''); if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { @@ -333,7 +332,7 @@ public static function handleException(Exception $e, OutputInterface $output): i * @return void * @throws InvalidArgumentException */ - public static function validateDomains(array $domains): void + public function validateDomains(array $domains): void { if (empty($domains)) { throw new InvalidArgumentException('Error: Domains parameter is missing.'); From e54737a2f1a7f0e70e44b47b5f21b64257995eac Mon Sep 17 00:00:00 2001 From: engcom-Dash Date: Thu, 24 Oct 2024 18:17:32 +0530 Subject: [PATCH 7/7] 38409: Fix static failures --- .../Downloadable/Console/Command/DomainsAddCommand.php | 5 ++--- .../Downloadable/Console/Command/DomainsRemoveCommand.php | 5 ++--- app/code/Magento/Downloadable/Helper/Download.php | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php index b7abf27a92c52..6e7ac77b8b261 100644 --- a/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php +++ b/app/code/Magento/Downloadable/Console/Command/DomainsAddCommand.php @@ -1,8 +1,7 @@