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

Modules unable to register Twig extensions if there are pending migrations #2833

Closed
mmikkel opened this issue May 2, 2018 · 1 comment
Closed

Comments

@mmikkel
Copy link
Contributor

mmikkel commented May 2, 2018

Description

Possibly related to #2831:

Updating from 3.0.3.1 to 3.0.5, Craft is unable to run database migrations due to the following exception:

LogicException
Unable to register extension "namespace\module\twigextensions\SomeTwigExtension" as extensions have already been initialized.

The exception is only thrown if there are pending database migrations. If the calls to Craft::$app->getView()->registerTwigExtension() are removed from the modules, the migrations/update completes successfully. After updating, the calls to registerTwigExtension() can be added back in without the exception being thrown on subsequent requests.

Steps to reproduce

  1. Add a custom Twig extension to a module's constructor or init() method using Craft::$app->getView()->registerTwigExtension()
  2. Make sure there are pending database migrations
  3. Visit /admin to run the migrations
  4. Confirm that a LogicException is thrown

Additional info

  • Craft version: 3.0.5
  • PHP version:
  • Database driver & version:
  • Plugins & versions:
@brandonkelly
Copy link
Member

Yep that definitely sounds related to #2831, which has been fixed now.

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

No branches or pull requests

2 participants