Contao: An error occurred while executing the "cache:warmup" command after twig 2.7 update

Created on 12 Mar 2019  路  1Comment  路  Source: contao/contao

Affected version(s)
4.7.1

Description
After a composer update twig was updated from v2.6.2 => v2.7.0. Now i got on two systems this error:

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


Fatal error: Declaration of Nelmio\SecurityBundle\Twig\TokenParser\AbstractCSPParser::parse(Twig_Token $token) must be compatible with Twig\TokenParser\TokenParserInterface::parse(Twig\Token $token) in D:\MAMP\htdocs\hello.localhost\vendor\nelmio\security-bundle\Twig\TokenParser\AbstractCSPParser.php on line 57
PHP Fatal error:  Declaration of Nelmio\SecurityBundle\Twig\TokenParser\AbstractCSPParser::parse(Twig_Token $token) must be compatible with Twig\TokenParser\TokenParserInterface::parse(Twig\Token $token) in D:\MAMP\htdocs\hello.localhost\vendor\nelmio\security-bundle\Twig\TokenParser\AbstractCSPParser.php on line 57

In AbstractCSPParser.php line 57:

  Compile Error: Declaration of Nelmio\SecurityBundle\Twig\TokenParser\AbstractCSPParser::parse(Twig_Token $token) mu
  st be compatible with Twig\TokenParser\TokenParserInterface::parse(Twig\Token $token)


cache:warmup [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

Script Contao\ManagerBundle\Composer\ScriptHandler::initializeApplication handling the post-update-cmd event terminated with an exception


  [RuntimeException]
  An error occurred while executing the "cache:warmup" command: PHP Fatal error:  Declaration of Nelmio\SecurityBundl
  e\Twig\TokenParser\AbstractCSPParser::parse(Twig_Token $token) must be compatible with Twig\TokenParser\TokenParser
  Interface::parse(Twig\Token $token) in D:\MAMP\htdocs\hello.localhost\vendor\nelmio\security-bundle\Twig\Token
  Parser\AbstractCSPParser.php on line 57

  In AbstractCSPParser.php line 57:


    Compile Error: Declaration of Nelmio\SecurityBundle\Twig\TokenParser\AbstractCSPParser::parse(Twig_Token
  $token) mu
    st be compatible with Twig\TokenParser\TokenParserInterface::parse(Twig\Token $token)

How to reproduce

Simply run composer update or contao-console cache-clear.

Most helpful comment

Yep, we're not compatible with Twig 2.7.0. If you use our new contao/conflicts repository as introduced on contao.org (https://contao.org/en/news/recap-of-the-first-contao-core-developers-meeting-2019.html), you would've not had this issue because we've already noticed it (see https://github.com/contao/conflicts/commit/0e87f56622e8a6857f0f408627ba5d1c8e449136) :sunglasses:

Just runcomposer require contao/conflicts:@dev to benefit from our conflicts repository.
The people using the Contao Manager don't have to do anything, it's done automatically for them.

>All comments

Yep, we're not compatible with Twig 2.7.0. If you use our new contao/conflicts repository as introduced on contao.org (https://contao.org/en/news/recap-of-the-first-contao-core-developers-meeting-2019.html), you would've not had this issue because we've already noticed it (see https://github.com/contao/conflicts/commit/0e87f56622e8a6857f0f408627ba5d1c8e449136) :sunglasses:

Just runcomposer require contao/conflicts:@dev to benefit from our conflicts repository.
The people using the Contao Manager don't have to do anything, it's done automatically for them.

Was this page helpful?
0 / 5 - 0 ratings