You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you provide an unknown command to the php file it will result in an Fatal Error:
`php laminas.php unknowncommand
PHP Notice: Undefined index: unknowncommand in /var/cli/importer/vendor/laminas/laminas-cli/src/AbstractContainerCommandLoader.php on line 64
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Laminas\ServiceManager\ServiceManager::Laminas\ServiceManager{closure}() must be of the type string, null given, called in /var/cli/importer/vendor/laminas/laminas-servicemanager/src/ServiceManager.php on line 270 and defined in /var/cli/importer/vendor/laminas/laminas-servicemanager/src/ServiceManager.php:262
Stack trace:
#0 /var/cli/importer/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(270): Laminas\ServiceManager\ServiceManager::Laminas\ServiceManager{closure}(NULL) #1 /var/cli/importer/vendor/laminas/laminas-cli/src/AbstractContainerCommandLoader.php(64): Laminas\ServiceManager\ServiceManager->has(NULL) #2 /var/cli/importer/vendor/laminas/laminas-cli/src/ContainerCommandLoaderTypeHint.php(22): Laminas\Cli\AbstractContainerCommandLoader->hasCommand('unknowncommand') #3 /var/cli/importer/vendor/symfony/console/Application.php(551): Laminas\Cli\ContainerCommandLoaderTypeHint->has('unknowncommand') #4 /var/cli/importer/vendor/symfony/console/Applicati in /var/cli/importer/vendor/laminas/laminas-servicemanager/src/ServiceManager.php on line 262`
The reason is the following:
Problem 1 is the lookup in the array without checking if the key exists. (that's the notice)
Problem 2 is the missing cast to string of the array
In the AbstractContainerCommandLoader:
if ($this->container->has($this->commandMap[$name])) { return $this->fetchCommandFromContainer($name); }
Current behavior
A Fatal Error
How to reproduce
Just call it with an unknown command.
Expected behavior
Message that command is invalid or not registered.
No notices ;)
The text was updated successfully, but these errors were encountered:
…om container
Updates `AbstractContainerCommandLoader::hasCommand()` to test if the `$name` exists in the `$commandMap` before attempting to check the container.
If not, it immediately returns false.
Fixeslaminas#64
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
…om container
Updates `AbstractContainerCommandLoader::hasCommand()` to test if the `$name` exists in the `$commandMap` before attempting to check the container.
If not, it immediately returns false.
Fixeslaminas#64
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
…om container
Updates `AbstractContainerCommandLoader::hasCommand()` to test if the `$name` exists in the `$commandMap` before attempting to check the container.
If not, it immediately returns false.
Fixeslaminas#64
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Bug Report
Summary
When you provide an unknown command to the php file it will result in an Fatal Error:
`php laminas.php unknowncommand
PHP Notice: Undefined index: unknowncommand in /var/cli/importer/vendor/laminas/laminas-cli/src/AbstractContainerCommandLoader.php on line 64
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Laminas\ServiceManager\ServiceManager::Laminas\ServiceManager{closure}() must be of the type string, null given, called in /var/cli/importer/vendor/laminas/laminas-servicemanager/src/ServiceManager.php on line 270 and defined in /var/cli/importer/vendor/laminas/laminas-servicemanager/src/ServiceManager.php:262
Stack trace:
#0 /var/cli/importer/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(270): Laminas\ServiceManager\ServiceManager::Laminas\ServiceManager{closure}(NULL)
#1 /var/cli/importer/vendor/laminas/laminas-cli/src/AbstractContainerCommandLoader.php(64): Laminas\ServiceManager\ServiceManager->has(NULL)
#2 /var/cli/importer/vendor/laminas/laminas-cli/src/ContainerCommandLoaderTypeHint.php(22): Laminas\Cli\AbstractContainerCommandLoader->hasCommand('unknowncommand')
#3 /var/cli/importer/vendor/symfony/console/Application.php(551): Laminas\Cli\ContainerCommandLoaderTypeHint->has('unknowncommand')
#4 /var/cli/importer/vendor/symfony/console/Applicati in /var/cli/importer/vendor/laminas/laminas-servicemanager/src/ServiceManager.php on line 262`
The reason is the following:
Problem 1 is the lookup in the array without checking if the key exists. (that's the notice)
Problem 2 is the missing cast to string of the array
In the AbstractContainerCommandLoader:
if ($this->container->has($this->commandMap[$name])) { return $this->fetchCommandFromContainer($name); }
Current behavior
A Fatal Error
How to reproduce
Just call it with an unknown command.
Expected behavior
Message that command is invalid or not registered.
No notices ;)
The text was updated successfully, but these errors were encountered: