Passed variable is not an array or object
Closed this issue · 4 comments
When updating to Contao 4.13.15 with dependencies you get the following error during cache:warmup:
An error occurred while executing the "/opt/alt/php-fpm74/usr/bin/php -d memory_limit=512M /.../vendor/contao/manager-bundle/bin/contao-console cache:warmup --env=prod --ansi" command: 10:51:06 CRITICAL [console] Error thrown while running command "cache:warmup --env=prod --ansi". Message: "Passed variable is not an array or object" ["exception" => 39;49m 38;5;38m InvalidArgumentException { …},"39;49m 113m command" => "cache:warmup --env=prod --ansi 39;49m 0;38;5;208m","message" => "39;49m ;113m Passed variable is not an array or object"39;49mm] In LibrariesConfiguration.php line 52: Passed variable is not an array or object cache:warmup [--no-optional-warmers]
Solution:
Define $GLOBALS['LEAFLET_LIBRARIES'] = [];
in config before using.
Hi @havutcuoglu can you please specify where to define the globals variable? What do you mean with „config“?
Right now I cannot install Leaflet Maps on Contao 4.13.15. After composer install the database update does not work and opening the install tool leads to a contao error:
ArrayIterator::__construct(): Argument #1 ($array) must be of type array, null given" at /FOLDER/vendor/netzmacht/contao-leaflet-maps/src/Frontend/Assets/LibrariesConfiguration.php line 52
I should add that my installation runs on PHP 8.0.
Added a new issue for my problem: #122
@Shoekrates I mean the default config.php by Contao-Root /contao/Config.php
.
@dmolineus I installed now contao version "name": "contao/core-bundle", "version": "4.13.20",
and Leaflet Map version "name": "netzmacht/contao-leaflet-maps", "version": "3.2.4",
with PHP version 8.1
The problem is now Warning: Undefined global variable $LEAFLET_LIBRARIES
I add again the line $GLOBALS['LEAFLET_LIBRARIES'] = [];
in /contao/Config.php and the problem is solved.
The fix on a2d1ae6 doesn't solve this problem.