[TypeError] ArrayIterator::__construct(): Argument #1 ($array) must be of type array, null given
Closed this issue · 1 comments
fritzmg commented
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 commented
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).