sonata-project / SonataIntlBundle

Symfony SonataIntlBundle
https://docs.sonata-project.org/projects/SonataIntlBundle
MIT License
213 stars 85 forks source link

default for locale must not null in list_decimal.html.twig #559

Closed ChristianSchaefer closed 2 years ago

ChristianSchaefer commented 2 years ago

Sonata packages

show

``` Direct dependencies required in composer.json: sonata-project/admin-bundle 4.18.0 4.18.0 The missing Symfony Admin Generator sonata-project/doctrine-orm-admin-bundle 4.7.0 4.7.0 Integrate Doctrine ORM into the SonataAdminBu... sonata-project/intl-bundle 3.0.0 3.0.0 Symfony SonataIntlBundle Transitive dependencies not required in composer.json: sonata-project/block-bundle 4.17.0 4.17.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library Package sonata-project/cache is abandoned, you should avoid using it. No replacement was suggested. sonata-project/doctrine-extensions 2.0.1 2.0.1 Doctrine2 behavioral extensions sonata-project/exporter 3.0.0 3.0.0 Lightweight Exporter library sonata-project/form-extensions 1.18.0 1.18.0 Symfony form extensions sonata-project/twig-extensions 2.0.0 2.0.0 Sonata twig extensions ```

Symfony packages

show

``` Direct dependencies required in composer.json: symfony/apache-pack v1.0.1 v1.0.1 A pack for Apache support in Symfony symfony/asset v5.4.7 v6.1.0 Manages URL generation and versioning of web asse... symfony/browser-kit v5.4.11 v6.1.3 Simulates the behavior of a web browser, allowing... symfony/console v5.4.12 v6.1.4 Eases the creation of beautiful and testable comm... symfony/css-selector v5.4.11 v6.1.3 Converts CSS selectors to XPath expressions symfony/debug-bundle v5.4.11 v6.1.3 Provides a tight integration of the Symfony VarDu... symfony/dotenv v5.4.5 v6.1.0 Registers environment variables from a .env file symfony/expression-language v5.4.11 v6.1.3 Provides an engine that can compile and evaluate ... symfony/flex v1.19.3 v2.2.3 Composer plugin for Symfony symfony/form v5.4.12 v6.1.4 Allows to easily create, process and reuse HTML f... symfony/framework-bundle v5.4.12 v6.1.4 Provides a tight integration between Symfony comp... symfony/http-client v5.4.12 v6.1.4 Provides powerful methods to fetch HTTP resources... symfony/intl v5.4.11 v6.1.0 Provides a PHP replacement layer for the C intl e... symfony/mailer v5.4.12 v6.1.4 Helps sending emails symfony/maker-bundle v1.45.0 v1.45.0 Symfony Maker helps you create empty commands, co... symfony/mime v5.4.12 v6.1.4 Allows manipulating MIME messages symfony/monolog-bundle v3.8.0 v3.8.0 Symfony MonologBundle symfony/notifier v5.4.8 v6.1.0 Sends notifications via one or more channels (ema... symfony/password-hasher v5.4.11 v6.1.3 Provides password hashing utilities symfony/phpunit-bridge v5.4.11 v6.1.3 Provides utilities for PHPUnit, especially user d... symfony/process v5.4.11 v6.1.3 Executes commands in sub-processes symfony/property-access v5.4.11 v6.1.3 Provides functions to read and write from/to an o... symfony/property-info v5.4.11 v6.1.3 Extracts information about PHP class' properties ... symfony/proxy-manager-bridge v5.4.6 v6.1.0 Provides integration for ProxyManager with variou... symfony/runtime v5.4.11 v6.1.3 Enables decoupling PHP applications from global s... symfony/security-bundle v5.4.11 v6.1.3 Provides a tight integration of the Security comp... symfony/serializer v5.4.12 v6.1.4 Handles serializing and deserializing data struct... symfony/stopwatch v5.4.5 v6.1.0 Provides a way to profile code symfony/string v5.4.12 v6.1.4 Provides an object-oriented API to strings and de... symfony/translation v5.4.12 v6.1.4 Provides tools to internationalize your application symfony/twig-bundle v5.4.8 v6.1.1 Provides a tight integration of Twig into the Sym... symfony/validator v5.4.12 v6.1.4 Provides tools to validate values symfony/web-link v5.4.3 v6.1.0 Manages links between resources symfony/web-profiler-bundle v5.4.10 v6.1.2 Provides a development tool that gives detailed i... symfony/yaml v5.4.12 v6.1.4 Loads and dumps YAML files Transitive dependencies not required in composer.json: symfony/cache v5.4.11 v6.1.3 Provides an extended PSR-6, PSR-16 (and tags) imp... symfony/cache-contracts v2.5.2 v3.1.1 Generic abstractions related to caching symfony/config v5.4.11 v6.1.3 Helps you find, load, combine, autofill and valid... symfony/dependency-injection v5.4.11 v6.1.3 Allows you to standardize and centralize the way ... symfony/deprecation-contracts v3.1.1 v3.1.1 A generic function and convention to trigger depr... symfony/doctrine-bridge v5.4.11 v6.1.3 Provides integration for Doctrine with various Sy... symfony/dom-crawler v5.4.12 v6.1.4 Eases DOM navigation for HTML and XML documents symfony/error-handler v5.4.11 v6.1.3 Provides tools to manage errors and ease debuggin... symfony/event-dispatcher v5.4.9 v6.1.0 Provides tools that allow your application compon... symfony/event-dispatcher-contracts v3.1.1 v3.1.1 Generic abstractions related to dispatching event symfony/filesystem v5.4.12 v6.1.4 Provides basic utilities for the filesystem symfony/finder v5.4.11 v6.1.3 Finds files and directories via an intuitive flue... symfony/http-client-contracts v2.5.2 v3.1.1 Generic abstractions related to HTTP clients symfony/http-foundation v5.4.12 v6.1.4 Defines an object-oriented layer for the HTTP spe... symfony/http-kernel v5.4.12 v6.1.4 Provides a structured process for converting a Re... symfony/monolog-bridge v5.4.10 v6.1.2 Provides integration for Monolog with various Sym... symfony/options-resolver v5.4.11 v6.1.0 Provides an improved replacement for the array_re... symfony/polyfill-intl-grapheme v1.26.0 v1.26.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu v1.26.0 v1.26.0 Symfony polyfill for intl's ICU-related data and ... symfony/polyfill-intl-idn v1.26.0 v1.26.0 Symfony polyfill for intl's idn_to_ascii and idn_... symfony/polyfill-intl-normalizer v1.26.0 v1.26.0 Symfony polyfill for intl's Normalizer class and ... symfony/polyfill-mbstring v1.26.0 v1.26.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php73 v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 7.3+ featur... symfony/polyfill-php80 v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 8.0+ featur... symfony/polyfill-php81 v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 8.1+ featur... symfony/routing v5.4.11 v6.1.3 Maps an HTTP request to a set of configuration va... symfony/security-acl v3.3.2 v3.3.2 Symfony Security Component - ACL (Access Control ... symfony/security-core v5.4.11 v6.1.4 Symfony Security Component - Core Library symfony/security-csrf v5.4.11 v6.1.0 Symfony Security Component - CSRF Library symfony/security-guard v5.4.9 v5.4.9 Symfony Security Component - Guard symfony/security-http v5.4.12 v6.1.4 Symfony Security Component - HTTP Integration symfony/service-contracts v2.5.2 v3.1.1 Generic abstractions related to writing services symfony/translation-contracts v2.5.2 v3.1.1 Generic abstractions related to translation symfony/twig-bridge v5.4.12 v6.1.4 Provides integration for Twig with various Symfon... symfony/var-dumper v5.4.11 v6.1.3 Provides mechanisms for walking through any arbit... symfony/var-exporter v5.4.10 v6.1.3 Allows exporting any serializable PHP data struct... ```

PHP version

PHP 8.1.9

Subject

I updated from latest version 2.x to 3.0 of the intl bundle and above error pops up. When I change the default in twig template list_decimal.html.twig to {}, all works fine.

Steps to reproduce

Add a field to listMapper in Admin without further settings

->add(
                'stepsBoardingQualification',
                null,
                [
                    'label' => 'stepsBoardingQualification',
                ]
            )
´´´

## Expected results

list view should be rendered

## Actual results

TypeError: Sonata\IntlBundle\Twig\NumberRuntime::formatDecimal(): Argument #4 ($symbols) must be of type array, null given, called in /var/www/html/var/cache/dev/twig/fe/fe57f13c5dd7b78305a4504755ed7025.php on line 83 ´´´

stacktrace.txt

VincentLanglet commented 2 years ago

I think the issue is more with the call

{{ value | sonata_number_format_decimal(attributes, textAttributes, locale) }}

it should be something like

{{ value | sonata_number_format_decimal(attributes, textAttributes, symbols, locale) }}

Maybe others twig have the same issue.

VincentLanglet commented 2 years ago

Should be fixed by https://github.com/sonata-project/SonataIntlBundle/pull/560, can you confirm it works for you ?

ChristianSchaefer commented 2 years ago

Yes, this fix works, thanks