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

Fix undefined global variable $LEAFLET_LIBRARIES #120

Closed
wants to merge 1 commit into from

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Jan 30, 2023

Fixes the following error that happens during cache:warmup under Contao 4.13 and PHP 8:

In LibrariesConfiguration.php line 52:

  [ErrorException]
  Warning: Undefined global variable $LEAFLET_LIBRARIES  


Exception trace:
  at vendor\netzmacht\contao-leaflet-maps\src\Frontend\Assets\LibrariesConfiguration.php:52
 Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration->getIterator() at vendor\netzmacht\contao-leaflet-maps\src\Listener\RegisterLibrariesListener.php:61
 Netzmacht\Contao\Leaflet\Listener\RegisterLibrariesListener->onInitializeSystem() at vendor\contao\contao\core-bundle\src\Framework\ContaoFramework.php:405
 Contao\CoreBundle\Framework\ContaoFramework->triggerInitializeSystemHook() at vendor\contao\contao\core-bundle\src\Framework\ContaoFramework.php:307

Not sure what the original intention with this global was - but for simplicity I decided to let it get initialized in Contao's config.php.

Copy link
Member

@dmolineus dmolineus left a comment

Choose a reason for hiding this comment

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

The libraries are provided by netzmacht/contao-leaflet-libraries. So it's an issue of the loading order. Instead of defining it here, the setLoadAfter information in the contao plugin should contain, leaflet-libs.

->setLoadAfter(
[
ContaoCoreBundle::class,
NetzmachtContaoToolkitBundle::class,
NetzmachtContaoPageContextBundle::class
]
)
->setReplace(['leaflet']),

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

Successfully merging this pull request may close these issues.

None yet

2 participants