Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ *generate:module* ] Error: Call to a member function getPath() on null when module name starts with a number #4147

Closed
Xarno opened this issue Sep 10, 2019 · 2 comments

Comments

@Xarno
Copy link

Xarno commented Sep 10, 2019

Problem/Motivation

When generating a module with a number as first char the drupal console throws an error.
I had no idea why and tried around for half an hour. That case should handled properly.

How to reproduce

drupal generate:module --module="3rdparty_roles" --machine-name="3rdparty_roles" --module-path="modules/custom" --description="Allow granting roles to users at signup time. For that a list of allowed users is maintained." --core="8.x" --package="Custom" --module-file

Result:

// generate:composer
Error: Call to a member function getPath() on null in /Users/name/repositories//vendor/drupal/console/src/Generator/ComposerGenerator.php on line 46 #0 /Users/name/repositories//vendor/drupal/console/src/Command/Generate/ComposerCommand.php(410): Drupal\Console\Generator\ComposerGenerator->generate(Array)
#1 /Users/name/repositories//vendor/symfony/console/Command/Command.php(255): Drupal\Console\Command\Generate\ComposerCommand->execute(Object(Symfony\Component\Console\Input\ArrayInput), Object(Drupal\Console\Core\Style\DrupalStyle))
#2 /Users/name/repositories//vendor/drupal/console-core/src/EventSubscriber/CallCommandListener.php(76): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Drupal\Console\Core\Style\DrupalStyle))
#3 /Users/name/repositories//vendor/symfony/event-dispatcher/EventDispatcher.php(212): Drupal\Console\Core\EventSubscriber\CallCommandListener->callCommands(Object(Symfony\Component\Console\Event\ConsoleTerminateEvent), 'console.termina...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#4 /Users/name/repositories//vendor/symfony/event-dispatcher/EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'console.termina...', Object(Symfony\Component\Console\Event\ConsoleTerminateEvent))
#5 /Users/name/repositories//vendor/symfony/console/Application.php(1014): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('console.termina...', Object(Symfony\Component\Console\Event\ConsoleTerminateEvent))
#6 /Users/name/repositories//vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(Drupal\Console\Command\Generate\ModuleCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /Users/name/repositories//vendor/drupal/console-core/src/Application.php(188): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /Users/name/repositories//vendor/drupal/console/src/Application.php(64): Drupal\Console\Core\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /Users/name/repositories//vendor/symfony/console/Application.php(148): Drupal\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /Users/name/repositories//vendor/drupal/console/bin/drupal.php(89): Symfony\Component\Console\Application->run()
#11 /Users/name/repositories//vendor/drupal/console/bin/drupal(4): require('/Users/name...')
#12 {main}
Error: Call to a member function getPath() on null in Drupal\Console\Generator\ComposerGenerator->generate() (line 46 of /Users/name/repositories//vendor/drupal/console/src/Generator/ComposerGenerator.php).

Details to include:

  • Drupal version: 8.6.17
  • Console version: 1.9.3
  • Console Launcher version: 1.9.3

Solution

Don't use a number as first char?! If this is forbidden then don't crash. Print a nice error message instead.

@LOBsTerr
Copy link
Member

PR #4148

@enzolutions
Copy link
Contributor

Fixed with #4148 will be included in 1.9.4 Release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants