Sonataadminbundle: transchoice filter missing required "message" parameter

Created on 14 Oct 2019  路  9Comments  路  Source: sonata-project/SonataAdminBundle

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
# Put the result here.
sonata-project/admin-bundle              3.54.0 3.54.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.18.1 3.18.1 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/core-bundle               3.17.0 3.17.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.5.0  3.0.1  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.3.1  1.3.1  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.10.0 3.10.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  2.0.1  2.0.1  Lightweight Exporter library

Symfony packages

$ composer show --latest 'symfony/*'
# Put the result here.
symfony/asset                      v4.3.5  v4.3.5  Symfony Asset Component
symfony/browser-kit                v4.3.5  v4.3.5  Symfony BrowserKit Component
symfony/cache                      v4.3.5  v4.3.5  Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v1.1.7  v1.1.7  Generic abstractions related to caching
symfony/config                     v4.3.5  v4.3.5  Symfony Config Component
symfony/console                    v4.3.5  v4.3.5  Symfony Console Component
symfony/css-selector               v4.3.5  v4.3.5  Symfony CssSelector Component
symfony/debug                      v4.3.5  v4.3.5  Symfony Debug Component
symfony/debug-bundle               v4.3.5  v4.3.5  Symfony DebugBundle
symfony/debug-pack                 v1.0.7  v1.0.7  A debug pack for Symfony projects
symfony/dependency-injection       v4.3.5  v4.3.5  Symfony DependencyInjection Component
symfony/doctrine-bridge            v4.3.5  v4.3.5  Symfony Doctrine Bridge
symfony/dom-crawler                v4.3.5  v4.3.5  Symfony DomCrawler Component
symfony/dotenv                     v4.3.5  v4.3.5  Registers environment variables from a .env file
symfony/event-dispatcher           v4.3.5  v4.3.5  Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.7  v1.1.7  Generic abstractions related to dispatching event
symfony/expression-language        v4.3.5  v4.3.5  Symfony ExpressionLanguage Component
symfony/filesystem                 v4.3.5  v4.3.5  Symfony Filesystem Component
symfony/finder                     v4.3.5  v4.3.5  Symfony Finder Component
symfony/flex                       v1.4.6  v1.4.6  Composer plugin for Symfony
symfony/form                       v4.3.5  v4.3.5  Symfony Form Component
symfony/framework-bundle           v4.3.5  v4.3.5  Symfony FrameworkBundle
symfony/http-foundation            v4.3.5  v4.3.5  Symfony HttpFoundation Component
symfony/http-kernel                v4.3.5  v4.3.5  Symfony HttpKernel Component
symfony/inflector                  v4.3.5  v4.3.5  Symfony Inflector Component
symfony/intl                       v4.3.5  v4.3.5  A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/maker-bundle               v1.13.0 v1.13.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/mime                       v4.3.5  v4.3.5  A library to manipulate MIME messages
symfony/monolog-bridge             v4.3.5  v4.3.5  Symfony Monolog Bridge
symfony/monolog-bundle             v3.4.0  v3.4.0  Symfony MonologBundle
symfony/options-resolver           v4.3.5  v4.3.5  Symfony OptionsResolver Component
symfony/orm-pack                   v1.0.6  v1.0.6  A pack for the Doctrine ORM
symfony/phpunit-bridge             v4.3.5  v4.3.5  Symfony PHPUnit Bridge
symfony/polyfill-intl-icu          v1.12.0 v1.12.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.12.0 v1.12.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring          v1.12.0 v1.12.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.12.0 v1.12.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.12.0 v1.12.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/process                    v4.3.5  v4.3.5  Symfony Process Component
symfony/profiler-pack              v1.0.4  v1.0.4  A pack for the Symfony web profiler
symfony/property-access            v4.3.5  v4.3.5  Symfony PropertyAccess Component
symfony/property-info              v4.3.5  v4.3.5  Symfony Property Info Component
symfony/routing                    v4.3.5  v4.3.5  Symfony Routing Component
symfony/security-acl               v3.0.2  v3.0.2  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.3.5  v4.3.5  Symfony SecurityBundle
symfony/security-core              v4.3.5  v4.3.5  Symfony Security Component - Core Library
symfony/security-csrf              v4.3.5  v4.3.5  Symfony Security Component - CSRF Library
symfony/security-guard             v4.3.5  v4.3.5  Symfony Security Component - Guard
symfony/security-http              v4.3.5  v4.3.5  Symfony Security Component - HTTP Integration
symfony/serializer                 v4.3.5  v4.3.5  Symfony Serializer Component
symfony/serializer-pack            v1.0.2  v1.0.2  A pack for the Symfony serializer
symfony/service-contracts          v1.1.7  v1.1.7  Generic abstractions related to writing services
symfony/stopwatch                  v4.3.5  v4.3.5  Symfony Stopwatch Component
symfony/swiftmailer-bundle         v3.2.8  v3.2.8  Symfony SwiftmailerBundle
symfony/templating                 v4.3.5  v4.3.5  Symfony Templating Component
symfony/test-pack                  v1.0.6  v1.0.6  A pack for functional and end-to-end testing within a Symfony app
symfony/translation                v4.3.5  v4.3.5  Symfony Translation Component
symfony/translation-contracts      v1.1.7  v1.1.7  Generic abstractions related to translation
symfony/twig-bridge                v4.3.5  v4.3.5  Symfony Twig Bridge
symfony/twig-bundle                v4.3.5  v4.3.5  Symfony TwigBundle
symfony/validator                  v4.3.5  v4.3.5  Symfony Validator Component
symfony/var-dumper                 v4.3.5  v4.3.5  Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v4.3.5  v4.3.5  A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-link                   v4.3.5  v4.3.5  Symfony WebLink Component
symfony/web-profiler-bundle        v4.3.5  v4.3.5  Symfony WebProfilerBundle
symfony/web-server-bundle          v4.3.5  v4.3.5  Symfony WebServerBundle
symfony/yaml                       v4.3.5  v4.3.5  Symfony Yaml Component

PHP version

$ php -v
# Put the result here.
PHP 7.2.18 (cli) (built: May  8 2019 03:11:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Subject

Missing the required parameter in ./sonata-project/admin-bundle/src/Resources/views/Block/block_stats.html.twig at line 23

Steps to reproduce

public function transchoice($message, $count, array $arguments = [], $domain = null, $locale = null)
{{ settings.text|transchoice({'%count%': pager.count()}, translation_domain) }}

Expected results

{{ settings.text|transchoice('',{'%count%': pager.count()}, translation_domain) }}

Actual results

throws an error Argument 3 passed to Symfony\Bridge\Twig\Extension\TranslationExtension::transchoice() must be of the type array, string given, called in /usr/src/app/var/cache/dev/twig/5a/5a29d84fbf99d129d1b2f5f615fa8c5ed4e0ddfaad716919755d27aeb6a1b538.php on line 86

bug

Most helpful comment

I'm drafting a release as we speak

All 9 comments

sorry, if my description is not very clean, cause it's my first issue reporting

Thank you so much for your first report @Deadpoolzzz!
Please, take a look at https://github.com/sonata-project/SonataAdminBundle/issues/5700#issuecomment-537118314.

@phansys thank you for the quick reply, but it's not working in 3.54.0, please advice the solution

Sorry, I guess the PR providing the fix for this issue (#5702) isn't present in any release yet. My apologies.
Maybe you could downgrade the dependency until the fix is available in a stable release.

Maybe you could downgrade the dependency until the fix is available in a stable release.

What is the release policy of Sonata ? I don't see a lot of patch version.
Since the PR was merged 13 day ago, there should have been a 3.54.1 release right after the merge instead waiting for the next minor version (~ next month if it's the same lead time of the last one).

I'm drafting a release as we speak

Thanks @greg0ire !

Was this page helpful?
0 / 5 - 0 ratings