Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 4.4 unknown inky_to_html filter

I recently updated Symfony to 4.4 (from 4.3) and can't have my translations files updated automatically (using php bin/console tran:up --force) any more. The error that pops up is:

In body.html.twig line 1:
Unknown "inky_to_html" filter.

The file in question is vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.html.twig which I never use, I have no idea why it's inclued all at a sudden. To get rid of the message I tried to require twig/inky-extra but that requires the ext-xsl-extension and I don't really want to bloat my code with things I don't need just to get rid of an error related to a twig-extension that's also not needed.

I tried to change the version of the translation-interface as described here, but that also didn't change anything.

I guess it has something to do with my project as I couldn't find any similar problem, but I can't figure it out, so any help is appreciated.

EDIT: Here's my composer.json, it's basically the same as it was generated when creating the Symfony 4.3-project, I only changed the version names to upgrade as described in the docs and ran composer update.

{
  "type": "project",
  "license": "proprietary",
  "require": {
    "php": "^7.1.3",
    "ext-ctype": "*",
    "ext-iconv": "*",
    "ext-intl": "*",
    "apy/breadcrumbtrail-bundle": "^1.5",
    "craue/config-bundle": "^2.3",
    "easycorp/easy-log-handler": "^1.0",
    "friendsofsymfony/jsrouting-bundle": "^2.4",
    "league/csv": "^9.4",
    "nesbot/carbon": "^2.25",
    "sensio/framework-extra-bundle": "^5.1",
    "sg/datatablesbundle": "^1.1",
    "symfony/apache-pack": "^1.0",
    "symfony/asset": "^4.0",
    "symfony/console": "^4.0",
    "symfony/dotenv": "^4.0",
    "symfony/expression-language": "^4.0",
    "symfony/flex": "^1.3.1",
    "symfony/form": "^4.0",
    "symfony/framework-bundle": "^4.0",
    "symfony/http-client": "^4.0",
    "symfony/intl": "^4.0",
    "symfony/monolog-bundle": "^3.1",
    "symfony/orm-pack": "*",
    "symfony/process": "^4.0",
    "symfony/security-bundle": "^4.0",
    "symfony/security-csrf": "^4.0",
    "symfony/serializer-pack": "*",
    "symfony/swiftmailer-bundle": "^3.1",
    "symfony/translation": "^4.0",
    "symfony/twig-bundle": "^4.0",
    "symfony/validator": "^4.0",
    "symfony/web-link": "^4.0",
    "symfony/yaml": "^4.0",
    "tetranz/select2entity-bundle": "^3.0"
  },
  "require-dev": {
    "dama/doctrine-test-bundle": "^6.1",
    "doctrine/doctrine-fixtures-bundle": "^3.2",
    "pdepend/pdepend": "^2.5",
    "phpmd/phpmd": "^2.7",
    "phpunit/php-code-coverage": "^7.0",
    "roave/security-advisories": "dev-master",
    "squizlabs/php_codesniffer": "3.*",
    "symfony/debug-pack": "*",
    "symfony/maker-bundle": "^1.0",
    "symfony/phpunit-bridge": "^4.3",
    "symfony/profiler-pack": "*",
    "symfony/test-pack": "*",
    "symfony/web-server-bundle": "^4.0"
  },
  "config": {
    "preferred-install": {
      "*": "dist"
    },
    "sort-packages": true
  },
  "autoload": {
    "psr-4": {
      "App\\": "src/"
    }
  },
  "autoload-dev": {
    "psr-4": {
      "App\\Tests\\": "tests/"
    }
  },
  "replace": {
    "paragonie/random_compat": "2.*",
    "symfony/polyfill-ctype": "*",
    "symfony/polyfill-iconv": "*",
    "symfony/polyfill-php71": "*",
    "symfony/polyfill-php70": "*",
    "symfony/polyfill-php56": "*"
  },
  "scripts": {
    "auto-scripts": {
      "cache:clear": "symfony-cmd",
      "assets:install %PUBLIC_DIR%": "symfony-cmd"
    },
    "post-install-cmd": [
      "@auto-scripts"
    ],
    "post-update-cmd": [
      "@auto-scripts"
    ]
  },
  "conflict": {
    "symfony/symfony": "*"
  },
  "extra": {
    "symfony": {
      "allow-contrib": false,
      "require": "4.4.*"
    }
  }
}
like image 241
Select0r Avatar asked Nov 25 '19 10:11

Select0r


1 Answers

symfony/twig-bridge:4.4 changed the dev requirements to require twig/inky-extra and also added the new Resources/views/Email template files that utilize the inky_to_html filter, that were not included in 4.3.

Since tran:up attempts to scan files within the <Bundle>/Resources/views directories of each bundle for translations, to circumvent the issue and avoid scanning the twig-bridge views, you should be able to specify the bundle name you want to update the translations of.

php bin/console tran:up <locale> <bundle or directory>

Outside of including the dev requirements to circumvent the issue, you would need to revert to symfony/symfony:4.3 to get rid of the new twig-bridge/Resources/views/Email directory.

Since you are using symfony/symfony:4.4 it requires the corresponding twig-bridge.

symfony/symfony:4.4 require [sic]

"symfony/twig-bridge": "self.version"

symfony/twig-bridge:4.4 require-dev [sic]

"twig/cssinliner-extra": "^2.12",
"twig/inky-extra": "^2.12",
"twig/markdown-extra": "^2.12"

Ultimately it appears to be a bug with the dev dependencies that should be reported to Symfony.


Update: A patch has been issued for version 3.4+, see: Fix the translation commands when a template contains a syntax error #34711

like image 199
Will B. Avatar answered Sep 30 '22 15:09

Will B.