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

[TypeError] ArrayIterator::__construct(): Argument #1 ($array) must be of type array, null given #133

Closed
fritzmg opened this issue Dec 5, 2024 · 1 comment

Comments

@fritzmg
Copy link
Contributor

fritzmg commented Dec 5, 2024

This error happens during cache:warmup:

[TypeError]
    ArrayIterator::__construct(): Argument #1 ($array) must be of type array, null given  

                                                                                                                                                                                                              
  Exception trace:
    at vendor\netzmacht\contao-leaflet-maps\src\Frontend\Assets\LibrariesConfiguration.php:54
   ArrayIterator->__construct() at vendor\netzmacht\contao-leaflet-maps\src\Frontend\Assets\LibrariesConfiguration.php:54
   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\core-bundle\src\Framework\ContaoFramework.php:405
   Contao\CoreBundle\Framework\ContaoFramework->triggerInitializeSystemHook() at vendor\contao\core-bundle\src\Framework\ContaoFramework.php:307
   Contao\CoreBundle\Framework\ContaoFramework->initializeFramework() at vendor\contao\core-bundle\src\Framework\ContaoFramework.php:122
   Contao\CoreBundle\Framework\ContaoFramework->initialize() at vendor\contao\core-bundle\src\Cache\ContaoCacheWarmer.php:62
   Contao\CoreBundle\Cache\ContaoCacheWarmer->warmUp() at vendor\symfony\http-kernel\CacheWarmer\CacheWarmerAggregate.php:99
   Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at vendor\symfony\framework-bundle\Command\CacheWarmupCommand.php:83
   Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand->execute() at vendor\symfony\console\Command\Command.php:298
   Symfony\Component\Console\Command\Command->run() at vendor\symfony\console\Application.php:1058
   Symfony\Component\Console\Application->doRunCommand() at vendor\symfony\framework-bundle\Console\Application.php:96
   Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at vendor\symfony\console\Application.php:301
   Symfony\Component\Console\Application->doRun() at vendor\symfony\framework-bundle\Console\Application.php:82
   Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at vendor\symfony\console\Application.php:171
   Symfony\Component\Console\Application->run() at vendor\contao\manager-bundle\bin\contao-console:38

This is related to #120, #127 and #124

The issue is the initializeSystem Hook RegisterLibrariesListener::onInitializeSystem. This hook will be called early during the cache warmup - and at that point the loading order of the legacy modules does not matter yet. That's why $GLOBALS['LEAFLET_LIBRARIES'] is not populated and thus leads to this error.

@fritzmg
Copy link
Contributor Author

fritzmg commented Dec 5, 2024

Ah, this error only occurs if you have a mis-configured composer.json ("type": "project" was missing - which then will not install any Contao 2/3 style extensions).

@fritzmg fritzmg closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2024
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

1 participant