Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"guzzlehttp/guzzle": "^6.3.3",
"laminas/laminas-captcha": "^2.7.1",
"laminas/laminas-code": "^3.5.1",
"laminas/laminas-console": "^2.6.0",
"laminas/laminas-crypt": "^3.4.0",
"laminas/laminas-db": "^2.12.0",
"laminas/laminas-dependency-plugin": "^2.1.0",
Expand All @@ -53,7 +52,6 @@
"laminas/laminas-mime": "^2.8.0",
"laminas/laminas-modulemanager": "^2.7",
"laminas/laminas-mvc": "^3.2.0",
"laminas/laminas-mvc-console": "^1.3.0",
"laminas/laminas-serializer": "^2.7.2",
"laminas/laminas-server": "^2.6.1",
"laminas/laminas-servicemanager": "^3.6.0",
Expand Down
202 changes: 39 additions & 163 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions setup/config/modules.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@
'Laminas\Router',
'Laminas\Serializer',
'Laminas\Session',
'Laminas\Validator',
'Laminas\Mvc\Console'
'Laminas\Validator'
];
19 changes: 9 additions & 10 deletions setup/src/Magento/Setup/Mvc/Bootstrap/InitParamListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
use Magento\Framework\App\State;
use Magento\Framework\Filesystem;
use Magento\Framework\Shell\ComplexParameter;
use Laminas\Console\Request;
use Laminas\EventManager\EventManagerInterface;
use Laminas\EventManager\ListenerAggregateInterface;
use Laminas\Mvc\Application;
use Laminas\Mvc\MvcEvent;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Laminas\Stdlib\RequestInterface;

/**
* A listener that injects relevant Magento initialization parameters and initializes filesystem
Expand Down Expand Up @@ -138,25 +136,26 @@ private function extractInitParameters(Application $application)
$result[$initKey] = $_SERVER[$initKey];
}
}
$result = array_replace_recursive($result, $this->extractFromCli($application->getRequest()));
return $result;

if (!isset($result['argv'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the following check in order to prevent type error if it's not array:

Suggested change
if (!isset($result['argv'])) {
if (!isset($result['argv']) || !is_array($result['argv'])) {

Also would be great to cover this case with a unit test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, will do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return $result;
}

return array_replace_recursive($result, $this->extractFromCli($result['argv']));
}

/**
* Extracts the directory paths from a CLI request
*
* Uses format of a URL query
*
* @param RequestInterface $request
* @param array $argv
* @return array
*/
private function extractFromCli(RequestInterface $request)
private function extractFromCli(array $argv): array
{
if (!($request instanceof Request)) {
return [];
}
$bootstrapParam = new ComplexParameter(self::BOOTSTRAP_PARAM);
foreach ($request->getContent() as $paramStr) {
foreach ($argv as $paramStr) {
$result = $bootstrapParam->getFromString($paramStr);
if (!empty($result)) {
return $result;
Expand Down
Loading