codefog/contao-news_categories

Exception when running Contao cron jobs on the command line

aschempp opened this issue ยท 2 comments

I get the following exception when the Contao 4.13 cron job is executed on the command line. This might go unnoticed on a lot of systems ๐Ÿ™ˆ

php81 vendor/bin/contao-console contao:cron
13:55:11 ERROR     [app] LogicException: MemoryTokenStorage must not be accessed before it was initialized. in vendor/contao/core-bundle/src/Csrf/MemoryTokenStorage.php:91
Stack trace:

#0 vendor/contao/core-bundle/src/Csrf/MemoryTokenStorage.php(47): Contao\CoreBundle\Csrf\MemoryTokenStorage->assertInitialized()
#1 vendor/symfony/security-csrf/CsrfTokenManager.php(72): Contao\CoreBundle\Csrf\MemoryTokenStorage->hasToken('contao_csrf_tok...')
#2 vendor/contao/core-bundle/src/Csrf/ContaoCsrfTokenManager.php(56): Symfony\Component\Security\Csrf\CsrfTokenManager->getToken('contao_csrf_tok...')
#3 vendor/contao/core-bundle/src/Csrf/ContaoCsrfTokenManager.php(105): Contao\CoreBundle\Csrf\ContaoCsrfTokenManager->getToken('contao_csrf_tok...')
#4 vendor/contao/core-bundle/src/Resources/contao/modules/ModuleLogin.php(110): Contao\CoreBundle\Csrf\ContaoCsrfTokenManager->getDefaultTokenValue()
#5 vendor/contao/core-bundle/src/Resources/contao/modules/Module.php(214): Contao\ModuleLogin->compile()
#6 vendor/contao/core-bundle/src/Resources/contao/modules/ModuleLogin.php(94): Contao\Module->generate()
#7 vendor/contao/core-bundle/src/Resources/contao/elements/ContentModule.php(98): Contao\ModuleLogin->generate()
#8 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php(621): Contao\ContentModule->generate()
#9 vendor/codefog/contao-news_categories/src/FeedGenerator.php(147): Contao\Controller::getContentElement(Object(Contao\ContentModel))
#10 vendor/contao/news-bundle/src/Resources/contao/classes/News.php(82): Codefog\NewsCategoriesBundle\FeedGenerator->generateFiles(Array)
#11 vendor/contao/core-bundle/src/Cron/LegacyCron.php(87): Contao\News->generateFeeds()
#12 vendor/contao/core-bundle/src/Cron/LegacyCron.php(49): Contao\CoreBundle\Cron\LegacyCron->runLegacyCrons('daily')
#13 vendor/contao/core-bundle/src/Cron/CronJob.php(44): Contao\CoreBundle\Cron\LegacyCron->onDaily('cli')
#14 vendor/contao/core-bundle/src/Cron/Cron.php(131): Contao\CoreBundle\Cron\CronJob->__invoke('cli')
#15 vendor/contao/core-bundle/src/Command/CronCommand.php(36): Contao\CoreBundle\Cron\Cron->run('cli')
#16 vendor/symfony/console/Command/Command.php(298): Contao\CoreBundle\Command\CronCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 vendor/symfony/console/Application.php(1058): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 vendor/symfony/framework-bundle/Console/Application.php(96): Symfony\Component\Console\Application->doRunCommand(Object(Contao\CoreBundle\Command\CronCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 vendor/symfony/console/Application.php(301): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Contao\CoreBundle\Command\CronCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 vendor/contao/manager-bundle/bin/contao-console(38): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#23 vendor/bin/contao-console(120)
#24 {main}

Should be fixed with 6cae57f. Can you try that?

Fix released 3.4.24 and 3.5.3.