agoat / contao-deferredimages-bundle

Contao 4 deferred images library
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Cache warmup error #10

Closed operatorone closed 5 years ago

operatorone commented 6 years ago

Got an error on cache warmup on a Contao 4.4.24.

// Warming up the cache for the prod environment with debug false

21:30:42 ERROR [console] Error thrown while running command "cache:warmup -vvv". Message: "[] operator not supported for strings" [ "exception" => Error {

message: "[] operator not supported for strings"

#code: 0
#file: "./vendor/agoat/contao-deferredimages/src/Resources/contao/config/config.php"
#line: 23
trace: {
  ./vendor/agoat/contao-deferredimages/src/Resources/contao/config/config.php:23 { …}
  ./vendor/contao/core-bundle/src/Resources/contao/library/Contao/Config.php:138 { …}
  ./vendor/contao/core-bundle/src/Resources/contao/library/Contao/Config.php:103 { …}
  ./vendor/contao/core-bundle/src/Framework/Adapter.php:47 { …}
  ./vendor/contao/core-bundle/src/Framework/ContaoFramework.php:316 { …}
  ./vendor/contao/core-bundle/src/Framework/ContaoFramework.php:159 { …}
  ./vendor/contao/core-bundle/src/Cache/ContaoCacheWarmer.php:94 { …}
  ./vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:52 { …}
  ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php:96 { …}
  ./vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:251 { …}
  ./vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:964 { …}
  ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:86 { …}
  ./vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:248 { …}
  ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:74 { …}
  ./vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148 { …}
  ./vendor/contao/manager-bundle/bin/contao-console:47 { …}
}

}, "command" => "cache:warmup -vvv", "message" => "[] operator not supported for strings" ] [] 21:30:42 DEBUG [console] Command "cache:warmup -vvv" exited with code "1" [ "command" => "cache:warmup -vvv", "code" => 1 ] []

In config.php line 23:

[Symfony\Component\Debug\Exception\FatalThrowableError]
[] operator not supported for strings

Exception trace: include() at /home/www/xxxx/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Config.php:138 Contao\Config->initialize() at /home/www/xxxx/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Config.php:103 Contao\Config::getInstance() at /home/www/xxxx/vendor/contao/core-bundle/src/Framework/Adapter.php:47 Contao\CoreBundle\Framework\Adapter->__call() at /home/www/xxxx/vendor/contao/core-bundle/src/Framework/ContaoFramework.php:316 Contao\CoreBundle\Framework\ContaoFramework->initializeFramework() at /home/www/xxxx/vendor/contao/core-bundle/src/Framework/ContaoFramework.php:159 Contao\CoreBundle\Framework\ContaoFramework->initialize() at /home/www/xxxx/vendor/contao/core-bundle/src/Cache/ContaoCacheWarmer.php:94 Contao\CoreBundle\Cache\ContaoCacheWarmer->warmUp() at /home/www/xxxx/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:52 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /home/www/xxxx/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php:96 Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand->execute() at /home/www/xxxx/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:251 Symfony\Component\Console\Command\Command->run() at /home/www/xxxx/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:964 Symfony\Component\Console\Application->doRunCommand() at /home/www/xxxx/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:86 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /home/www/xxxx/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:248 Symfony\Component\Console\Application->doRun() at /home/www/xxxx/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:74 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/www/xxxx/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148 Symfony\Component\Console\Application->run() at /home/www/xxxx/vendor/contao/manager-bundle/bin/contao-console:47

SOLUTION: Change line 23 $GLOBALS['BE_MOD']['content']['article']['stylesheet'][]= 'bundles/agoatdeferredimages/style.css'; and 29 $GLOBALS['BE_MOD']['content']['news']['stylesheet'][] = 'bundles/agoatdeferredimages/style.css';

to 23 $GLOBALS['BE_MOD']['content']['article']['stylesheet'] = 'bundles/agoatdeferredimages/style.css'; and 29 $GLOBALS['BE_MOD']['content']['news']['stylesheet'] = 'bundles/agoatdeferredimages/style.css';

agoat commented 6 years ago

Yeah, that looks like a incompatibility with PHP 7.1+ in combination with another extension setting a backend stylesheet as a simple string (which is wrong) instead of adding another array item.

I never got this error in contao 4.4, 4.5 on PHP 7.0, 7.1 and 7.2..

You should look on the other extensions you installed and search for the one setting the $GLOBALS['BE_MOD']['content']['article']['stylesheet'] as string.