Coder Social home page Coder Social logo

sonata-project / sonataintlbundle Goto Github PK

View Code? Open in Web Editor NEW
214.0 22.0 86.0 1010 KB

Symfony SonataIntlBundle

Home Page: https://docs.sonata-project.org/projects/SonataIntlBundle

License: MIT License

PHP 90.01% Makefile 2.04% Twig 7.95%
bundle date intl number php sonata symfony symfony-bundle time

sonataintlbundle's Introduction

SonataIntlBundle

Symfony SonataIntlBundle

Latest Stable Version Latest Unstable Version Psalm Type Coverage License

Total Downloads Monthly Downloads Daily Downloads

Branch Github Actions Code Coverage Documentation
3.x Test Coverage Status Documentation Status
4.x Test Coverage Status Documentation Status

Documentation

Check out the documentation on the official website.

Support

For general support and questions, please use StackOverflow.

If you think you found a bug or you have a feature idea to propose, feel free to open an issue after looking at the contributing guide.

License

This package is available under the MIT license.

sonataintlbundle's People

Contributors

asm89 avatar benji07 avatar bladrak avatar core23 avatar emmanuelvella avatar franmomu avatar greg0ire avatar hanmac avatar jordisala1991 avatar koc avatar kunicmarko20 avatar mickaelandrieu avatar nicolasricci avatar oskarstark avatar petk avatar phansys avatar pulzarraider avatar rande avatar romain-geissler avatar shulard avatar sonataci avatar soullivaneuh avatar ste93cry avatar taluu avatar temp avatar toooni avatar viliam-husar avatar vincentlanglet avatar xwb avatar yohang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonataintlbundle's Issues

Make Templating Dependency Optional

Related to #76

because it already uses twig, and some bundles might react differently when templating is included.

Sonata also don't use them directly, they just use the getCharset method.

wouldn't it be better to do it similar to the knp-menu-bundle that checks for templating and if exist connects its existing twig helper to the templating helper?

sonata.intl.templating.helper.number service does not exist

Environment

Sonata packages

show

sonata-project/admin-bundle              4.2.1     4.2.1     The missing Symfony Admin Generator
sonata-project/block-bundle              4.8.0     4.8.0     Symfony SonataBlockBundle
sonata-project/cache                     2.2.0     2.2.0     Cache library
sonata-project/datagrid-bundle           3.4.1     3.4.1     Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.15.0    1.15.0    Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 4.1.0     4.1.0     Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  2.9.0     2.9.0     Lightweight Exporter library
sonata-project/form-extensions           1.12.1    1.12.1    Symfony form extensions
sonata-project/intl-bundle               2.10.2    2.11.0    Symfony SonataIntlBundle
sonata-project/seo-bundle                3.0.0-RC1 3.0.0-RC1 Symfony SonataSeoBundle
sonata-project/twig-extensions           1.9.0     1.9.0     Sonata twig extensions

Symfony packages

show

symfony/asset                      v5.3.4  v5.3.4  Manages URL generation and versioning of web assets such as CSS style...
symfony/browser-kit                v5.3.4  v5.3.4  Simulates the behavior of a web browser, allowing you to make request...
symfony/cache                      v5.3.10 v5.3.10 Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts            v2.4.0  v2.4.0  Generic abstractions related to caching
symfony/config                     v5.3.10 v5.3.10 Helps you find, load, combine, autofill and validate configuration va...
symfony/console                    v5.3.10 v5.3.10 Eases the creation of beautiful and testable command line interfaces
symfony/dependency-injection       v5.3.10 v5.3.10 Allows you to standardize and centralize the way objects are construc...
symfony/deprecation-contracts      v2.4.0  v2.4.0  A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge            v5.3.8  v5.3.8  Provides integration for Doctrine with various Symfony components
symfony/dom-crawler                v5.3.7  v5.3.7  Eases DOM navigation for HTML and XML documents
symfony/error-handler              v5.3.7  v5.3.7  Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher           v5.3.7  v5.3.7  Provides tools that allow your application components to communicate ...
symfony/event-dispatcher-contracts v2.4.0  v2.4.0  Generic abstractions related to dispatching event
symfony/expression-language        v5.3.7  v5.3.7  Provides an engine that can compile and evaluate expressions
symfony/filesystem                 v5.3.4  v5.3.4  Provides basic utilities for the filesystem
symfony/finder                     v5.3.7  v5.3.7  Finds files and directories via an intuitive fluent interface
symfony/form                       v5.3.10 v5.3.10 Allows to easily create, process and reuse HTML forms
symfony/framework-bundle           v5.3.10 v5.3.10 Provides a tight integration between Symfony components and the Symfo...
symfony/http-client-contracts      v2.4.0  v2.4.0  Generic abstractions related to HTTP clients
symfony/http-foundation            v5.3.10 v5.3.10 Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                v5.3.10 v5.3.10 Provides a structured process for converting a Request into a Response
symfony/intl                       v5.3.8  v5.3.8  Provides a PHP replacement layer for the C intl extension that includ...
symfony/mailer                     v5.3.9  v5.3.9  Helps sending emails
symfony/mime                       v5.3.8  v5.3.8  Allows manipulating MIME messages
symfony/options-resolver           v5.3.7  v5.3.7  Provides an improved replacement for the array_replace PHP function
symfony/password-hasher            v5.3.8  v5.3.8  Provides password hashing utilities
symfony/polyfill-ctype             v1.23.0 v1.23.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme     v1.23.1 v1.23.1 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu          v1.23.0 v1.23.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.23.0 v1.23.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.23.0 v1.23.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.23.1 v1.23.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP vers...
symfony/polyfill-php73             v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP vers...
symfony/polyfill-php80             v1.23.1 v1.23.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP vers...
symfony/polyfill-php81             v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP vers...
symfony/property-access            v5.3.8  v5.3.8  Provides functions to read and write from/to an object or array using...
symfony/property-info              v5.3.8  v5.3.8  Extracts information about PHP class' properties using metadata of po...
symfony/routing                    v5.3.7  v5.3.7  Maps an HTTP request to a set of configuration variables
symfony/security-acl               v3.2.0  v3.2.0  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v5.3.8  v5.3.8  Provides a tight integration of the Security component into the Symfo...
symfony/security-core              v5.3.10 v5.3.10 Symfony Security Component - Core Library
symfony/security-csrf              v5.3.4  v5.3.4  Symfony Security Component - CSRF Library
symfony/security-guard             v5.3.7  v5.3.7  Symfony Security Component - Guard
symfony/security-http              v5.3.10 v5.3.10 Symfony Security Component - HTTP Integration
symfony/service-contracts          v2.4.0  v2.4.0  Generic abstractions related to writing services
symfony/string                     v5.3.10 v5.3.10 Provides an object-oriented API to strings and deals with bytes, UTF-...
symfony/templating                 v5.3.7  v5.3.7  Provides all the tools needed to build any kind of template system
symfony/translation                v5.3.10 v5.3.10 Provides tools to internationalize your application
symfony/translation-contracts      v2.4.0  v2.4.0  Generic abstractions related to translation
symfony/twig-bridge                v5.3.7  v5.3.7  Provides integration for Twig with various Symfony components
symfony/twig-bundle                v5.3.10 v5.3.10 Provides a tight integration of Twig into the Symfony full-stack fram...
symfony/validator                  v5.3.10 v5.3.10 Provides tools to validate values
symfony/var-dumper                 v5.3.10 v5.3.10 Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter               v5.3.8  v5.3.8  Allows exporting any serializable PHP data structure to plain PHP code

PHP version

PHP 8.0.9 (cli) (built: Jul 29 2021 17:21:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.9, Copyright (c) Zend Technologies
    with Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick Rethans
    with Zend OPcache v8.0.9, Copyright (c), by Zend Technologies

Subject

When using the latest release (2.11.0), the kernel cannot boot. Using the previous release works.

Might releate to #475

Steps to reproduce

Clear cache. Try to create a request

Expected results

No error

Actual results

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException : The service "sonata.intl.twig.extension.number" has a dependency on a non-existent service "sonata.intl.templating.helper.number". Did you mean one of these: "sonata.block.templating.helper", "sonata.intl.templating.helper.locale"?
 /Users/***/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:86
 /Users/***/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:81
 /Users/***/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:49
 /Users/***/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:90
 /Users/***/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:49
 /Users/***/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:81
 /Users/***/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:49
 /Users/***/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:46
 /Users/***/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:40
 /Users/***/vendor/symfony/dependency-injection/Compiler/Compiler.php:91
 /Users/***/vendor/symfony/dependency-injection/ContainerBuilder.php:744
 /Users/***/vendor/symfony/http-kernel/Kernel.php:545
 /Users/***/vendor/symfony/http-kernel/Kernel.php:786
 /Users/***/vendor/symfony/http-kernel/Kernel.php:125

Deprecate some Twig extensions

The official twig extensions repository provides these filters: https://github.com/twigphp/Twig-extensions/blob/2c2a90088f34be0b35c5c80ea55704a602c4fdb4/lib/Twig/Extensions/Extension/Intl.php#L27-L29

I tested some of them:

<p>
    {{ 'now'|format_datetime(null, 'en') }}
    <br>
    {{ 'now'|format_datetime(null, 'fr') }}
</p>
<p>
    {{ 'now'|localizeddate('medium', 'medium', 'en') }}
    <br>
    {{ 'now'|localizeddate('medium', 'medium', 'fr') }}
</p>

The result is exactly the same.

I think we should consider deprecate the duplicate filter and use the official extensions instead.

One of the possible issue is the admin usage: https://sonata-project.org/bundles/intl/2-x/doc/reference/datetime.html#php-usage

But I think we can fallback to the official extension too. In case the extension is not loaded, we may:

  1. Raise an error telling the end user to activate the extension himself.
  2. Load the twig extension from the concerned bundle (admin for the previous link). We should not load it from intl-bundle because it's not our role and we may load an unused extension.

I'll prefer option 1. Option 2 will be to "magical" for the end user IMHO.

Though?

Provide autowiring for DateTimeHelper

Ref:

  Cannot autowire service "AppBundle\Mailer\LegacyMailer": argument "$dateTimeHelper" of method "__construct()" references class "Sonata\IntlBundle\Templating\Helper\DateTimeHelper" but no such service exists. You should maybe alias this class to the existing "sonata.i  
  ntl.templating.helper.datetime" service.                                                                                                                                                                                                                                     

InvalidArgumentException in UserBasedTimezoneDetector.php line 36

The error message clearly says:

Argument 1 should be an instance of Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface or Symfony\Component\Security\Core\SecurityContextInterface"

but the TokenStorageInteface is checked against: Symfony\Component\Security\Csrf\TokenStorage\TokenStorageInterface; specified in use statemtns

Strict type checking introduced in 2.6.0 throws error on Doctrine decimal type

Environment

PHP 7.2
Symfony 4.2.8
sonata-project/admin-bundle 3.48.1
sonata-project/intl-bundle 2.6.0

Subject

After upgrading from 2.5.0 to 2.6.0 field that uses Doctrine DECIMAL type, which is implemented as PHP string, throws error like:
NumberFormatter::formatCurrency() expects parameter 1 to be float, string given
This is because of strict type checking.

Steps to reproduce

Try to format Doctrine DECIMAL type as currency.

Expected results

Keep compatibility with previous behavior by removing strict type checking or, better, by making sure that value is passed as accepted type - float for decimal.

Actual results

Exception NumberFormatter::formatCurrency() expects parameter 1 to be float, string given:
in vendor/sonata-project/intl-bundle/src/Templating/Helper/NumberHelper.php (line 162)
in vendor/sonata-project/intl-bundle/src/Templating/Helper/NumberHelper.php->formatCurrency (line 162)
in vendor/sonata-project/intl-bundle/src/Twig/Extension/NumberExtension.php->formatCurrency (line 83)

Region ignored in language filter

There is a bug in LocaleHelper.php :
$name = Intl::getLanguageBundle()->getLanguageName($codes[0], isset($codes[1]) ? $code[1] : null, $locale ?: $this->localeDetector->getLocale());

Parameter $code[1] should be $codes[1].
Right now the region is being ignored.

Wrong year?

Hi,

//date variable set to 01.01.1955
Somehow strange but with {{ dateobject | format_date('MMMM Y', 'de', 'Europe/Zurich') }} will give me "Januar 1954" (wrong year!). 01.01.1955 is not the only one, for my example 01.01.1960 as well (->1959).

The thing is that this happens only on sometimes (dont see a cycle yet) and when i change the day to 04.01.1960 it'll work (01., 02., 03. not).

Any ideas?

Best,
Marc

Replace intl with Symfony/Intl

https://github.com/symfony/Intl
https://packagist.org/packages/symfony/intl

Symfony/Intl names itself a "dropin-replacement" for ext/intl, thus in theory it should work out of the box, but without the requirement to actually install ext/intl (which nonetheless still remains possible).

The downside I see

The replacement layer is limited to the locale "en". If you want to use other locales, you should install the intl extension instead.

But probably SonataIntlBundle can share some code nonetheless.

RequestStackDetector does not have the default locale anymore.

In Sonata-intl 2.11, I got an error message

NumberFormatter::__construct() expects parameter 1 to be string, bool given

that I don't have with Sonata-Intl 2.10.

When I debug, I discovered that the RequestStackDetector receive false for the argument $defaultLocale.
With Sonata-Intl, instead of false, it correctly receive 'fr'.

Could it be related to the migration of the config in https://github.com/sonata-project/SonataIntlBundle/pull/475/files cc @jordisala1991 @franmomu @Kocal ?

Strict type checking throws error on formatting Doctrine decimal type as number

Environment

Sonata packages

show

$ composer show --latest 'sonata-project/*'

sonata-project/admin-bundle              3.102.0 3.102.0 The missing Symfony Admin Generator
sonata-project/block-bundle              4.6.0   4.6.0   Symfony SonataBlockBundle
sonata-project/cache                     2.1.1   2.1.1   Cache library
sonata-project/doctrine-extensions       1.13.0  1.13.0  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.34.3  3.34.3  Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  2.7.0   2.7.0   Lightweight Exporter library
sonata-project/form-extensions           1.9.0   1.9.0   Symfony form extensions
sonata-project/intl-bundle               2.10.1  2.10.1  Symfony SonataIntlBundle
sonata-project/translation-bundle        2.8.1   2.8.1   SonataTranslationBundle
sonata-project/twig-extensions           1.6.0   1.6.0   Sonata twig extensions

Symfony packages

show

$ composer show --latest 'symfony/*'
# Put the result here.

PHP version

$ php -v
PHP 8.0.0 (cli) (built: Dec  1 2020 03:33:03) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies

Subject

When rendering a Doctrine DECIMAL type (PHP type is string) the NumberHelper::formatDecimal is called. Eventually a \NumberFormatter::format is called which accepts int | float only. Since declare(strict_types=1); is set PHP throws an error.

Exactly the same issue has been reported and fixed for NumberHelper::formatCurrency in the past.

#256

Minimal repository with the bug

Steps to reproduce

Try to format Doctrine DECIMAL type as number in for example the configureListFields .

Expected results

Actual results

TypeError:
NumberFormatter::format(): Argument #1 ($num) must be of type int|float, string given

  at /app/vendor/sonata-project/intl-bundle/src/Templating/Helper/NumberHelper.php:225
  at NumberFormatter->format('15.04')
     (/app/vendor/sonata-project/intl-bundle/src/Templating/Helper/NumberHelper.php:225)
  at Sonata\IntlBundle\Templating\Helper\NumberHelper->format('15.04', 1, array(), array(), null, null)
     (/app/vendor/sonata-project/intl-bundle/src/Templating/Helper/NumberHelper.php:114)
  at Sonata\IntlBundle\Templating\Helper\NumberHelper->formatDecimal('15.04', array(), array(), null, null)
     (/app/vendor/sonata-project/intl-bundle/src/Twig/Extension/NumberExtension.php:106)

Conflict with sonata-project/intl-bundle

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.62.1 3.62.1 The missing Symfony Admin Generator
sonata-project/block-bundle              3.18.4 4.1.0  Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/core-bundle               3.18.0 3.18.0 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle           2.5.0  3.1.1  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.5.1  1.5.1  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.15.0 3.15.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  2.2.0  2.2.0  Lightweight Exporter library
sonata-project/intl-bundle               2.7.0  2.7.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.24.0 3.24.0 Symfony SonataMediaBundle
sonata-project/user-bundle               4.5.2  4.5.2  Symfony SonataUserBundle

Symfony packages

$ composer show --latest 'symfony/*'
symfony/asset                      v4.4.5  v5.0.5  Symfony Asset Component
symfony/browser-kit                v5.0.5  v5.0.5  Symfony BrowserKit Component
symfony/cache                      v4.4.5  v5.0.5  Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v2.0.1  v2.0.1  Generic abstractions related to caching
symfony/config                     v4.4.5  v5.0.5  Symfony Config Component
symfony/console                    v4.4.5  v5.0.5  Symfony Console Component
symfony/css-selector               v5.0.5  v5.0.5  Symfony CssSelector Component
symfony/debug                      v4.4.5  v4.4.5  Symfony Debug Component
symfony/debug-bundle               v5.0.5  v5.0.5  Symfony DebugBundle
symfony/debug-pack                 v1.0.7  v1.0.7  A debug pack for Symfony projects
symfony/dependency-injection       v4.4.5  v5.0.5  Symfony DependencyInjection Component
symfony/doctrine-bridge            v4.4.5  v5.0.5  Symfony Doctrine Bridge
symfony/dom-crawler                v5.0.5  v5.0.5  Symfony DomCrawler Component
symfony/dotenv                     v5.0.5  v5.0.5  Registers environment variables from a .env file
symfony/error-handler              v4.4.5  v5.0.5  Symfony ErrorHandler Component
symfony/event-dispatcher           v4.4.5  v5.0.5  Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.7  v2.0.1  Generic abstractions related to dispatching event
symfony/expression-language        v4.4.5  v5.0.5  Symfony ExpressionLanguage Component
symfony/filesystem                 v4.4.5  v5.0.5  Symfony Filesystem Component
symfony/finder                     v4.4.5  v5.0.5  Symfony Finder Component
symfony/flex                       v1.6.2  v1.6.2  Composer plugin for Symfony
symfony/form                       v4.4.5  v5.0.5  Symfony Form Component
symfony/framework-bundle           v4.4.5  v5.0.5  Symfony FrameworkBundle
symfony/http-client                v5.0.5  v5.0.5  Symfony HttpClient component
symfony/http-client-contracts      v2.0.1  v2.0.1  Generic abstractions related to HTTP clients
symfony/http-foundation            v4.4.5  v5.0.5  Symfony HttpFoundation Component
symfony/http-kernel                v4.4.5  v5.0.5  Symfony HttpKernel Component
symfony/inflector                  v5.0.5  v5.0.5  Symfony Inflector Component
symfony/intl                       v4.4.5  v5.0.5  A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/maker-bundle               v1.14.6 v1.14.6 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/messenger                  v5.0.5  v5.0.5  Symfony Messenger Component
symfony/mime                       v4.4.5  v5.0.5  A library to manipulate MIME messages
symfony/monolog-bridge             v5.0.5  v5.0.5  Symfony Monolog Bridge
symfony/monolog-bundle             v3.5.0  v3.5.0  Symfony MonologBundle
symfony/options-resolver           v4.4.5  v5.0.5  Symfony OptionsResolver Component
symfony/phpunit-bridge             v5.0.5  v5.0.5  Symfony PHPUnit Bridge
symfony/process                    v4.4.5  v5.0.5  Symfony Process Component
symfony/profiler-pack              v1.0.4  v1.0.4  A pack for the Symfony web profiler
symfony/property-access            v4.4.5  v5.0.5  Symfony PropertyAccess Component
symfony/property-info              v5.0.5  v5.0.5  Symfony Property Info Component
symfony/proxy-manager-bridge       v4.4.5  v5.0.5  Symfony ProxyManager Bridge
symfony/requirements-checker       v1.1.5  v1.1.5  Check Symfony requirements and give recommendations
symfony/routing                    v4.4.5  v5.0.5  Symfony Routing Component
symfony/security                   v4.4.5  v4.4.5  Symfony Security Component
symfony/security-acl               v3.0.4  v3.0.4  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.4.5  v5.0.5  Symfony SecurityBundle
symfony/serializer                 v5.0.5  v5.0.5  Symfony Serializer Component
symfony/service-contracts          v2.0.1  v2.0.1  Generic abstractions related to writing services
symfony/stopwatch                  v5.0.5  v5.0.5  Symfony Stopwatch Component
symfony/swiftmailer-bundle         v3.4.0  v3.4.0  Symfony SwiftmailerBundle
symfony/templating                 v4.4.5  v5.0.5  Symfony Templating Component
symfony/translation                v4.4.5  v5.0.5  Symfony Translation Component
symfony/translation-contracts      v2.0.1  v2.0.1  Generic abstractions related to translation
symfony/twig-bridge                v4.4.5  v5.0.5  Symfony Twig Bridge
symfony/twig-bundle                v4.4.5  v5.0.5  Symfony TwigBundle
symfony/validator                  v4.4.5  v5.0.5  Symfony Validator Component
symfony/var-dumper                 v5.0.5  v5.0.5  Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v5.0.5  v5.0.5  A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-profiler-bundle        v5.0.5  v5.0.5  Symfony WebProfilerBundle
symfony/web-server-bundle          v4.4.5  v4.4.5  Symfony WebServerBundle
symfony/webpack-encore-bundle      v1.7.3  v1.7.3  Integration with your Symfony app & Webpack Encore!
symfony/workflow                   v5.0.5  v5.0.5  Symfony Workflow Component
symfony/yaml                       v4.4.5  v5.0.5  Symfony Yaml Component

PHP version

$ php -v
PHP 7.3.11 (cli) (built: Oct 25 2019 02:24:51) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.11, Copyright (c) 1999-2018, by Zend Technologies
    with blackfire v1.31.0~linux-x64-non_zts73, https://blackfire.io, by Blackfire

Subject

Twig's function format_datetime provided by "sonata-project/intl-bundle" is being replaced by the one provided by "twig/intl-extra", causing exceptions derived by its different signatures.
I found this issue after updating my dependencies, including "sonata-project/admin-bundle".
See sonata-project/SonataAdminBundle#5835.

Steps to reproduce

$ composer require "sonata-project/intl-bundle" "sonata-project/admin-bundle:^3.62.1"
{{ date | format_datetime(pattern, locale, timezone, dateType, timeType) }}

Expected results

The i18n date being printed.

Actual results

Argument 4 passed to Twig\Extra\Intl\IntlExtension::createDateFormatter() must be of the type string, null given, called in /var/www/html/app/vendor/twig/intl-extra/src/IntlExtension.php on line 260 

Currency digits

Hi,

I'm trying to change the number of digits for the number_format_currency function.

My code:
{{ currencyValue | number_format_currency(currencyCode, {'fraction_digits' : 0}) }}

It is possible to change this parameter with the currency function ?

There is no extension able to load the configuration for "sonata_intl"

Hello,

I'm trying to use this bundle ...

Using symfony 2.1.5 DEV ... put in config.yml

sonata_intl:
timezone:
# Default timezone used the fallback
default: Europe / London
# Locale specific overrides
locales:
fr: Europe / Paris
en: Europe / London
en: Europe / London

But always get this error:

InvalidArgumentException: There is no extension Able to load the configuration for "sonata_intl"

What am I doing wrong?

Thanks in advance,

Paulo

The definition for "b005d56e3d1726e6bb0a24fb1a4f191e_1" has no class

Hello everybody

Since I've updated to the last commit (8ab0b0e) I have got this error:

[Symfony\Component\DependencyInjection\Exception\RuntimeException]                                                                                                                                                                                                                                                      
The definition for "b005d56e3d1726e6bb0a24fb1a4f191e_1" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.

If I rollback to the previous commit (3bd36c0) I don't have this error anymore.

Thank you

Incompatible with php8

DateTimeHelper create IntlDateFormatter instance:

        $formatter = self::createInstance([
            'locale' => $locale ?: $this->localeDetector->getLocale(),
            'datetype' => $dateType ?? \IntlDateFormatter::MEDIUM,
            'timetype' => \IntlDateFormatter::NONE,
            'timezone' => $timezone ?: $this->timezoneDetector->getTimezone(),
            'calendar' => \IntlDateFormatter::GREGORIAN,
        ]);

In php8 some arguments was renamed. And this code will be

        $formatter = self::createInstance([
            'locale' => $locale ?: $this->localeDetector->getLocale(),
            'dateType' => $dateType ?? \IntlDateFormatter::MEDIUM,
            'timeType' => \IntlDateFormatter::NONE,
            'timezone' => $timezone ?: $this->timezoneDetector->getTimezone(),
            'calendar' => \IntlDateFormatter::GREGORIAN,
        ]);

Flexible currency formatting

Hi.

I played with number helper, and I like it, but because of the nature of NumberFormatter and it's limitations, the results were not perfect IMO, and I think there is a place for improvements.

Two examples (I used 123 | number_format_decimal | number_format_currency(currency)):

Locale: en
Currency: EUR
Value: 123.00
Rendered: €123.00
Expected: 123.00 €

Locale: sr_Latn
Currency: RSD
Value: 123
Rendered: din. 172
Expected: 172.00 din.

I know that this may be issue with Intl extension itself, or icu data, but it would be nice to optionally have control over currency sign position.
Also, it would be great if currency can be globally configured, just like timezone and locale.

I would like to hear your opinon, I am willing to help with a PR for one of this improvements if you give me more info.

Thanks for this nice bundle!

Twig filter format_datetime problème if date is near the end of the year

Hello,
I have an issue with format_datetime when I have a datetime like this one :

2013-12-30 11:23:55

and doing a

{{ date | format_datetime('d MMMM YYYY à HH:mm:ss', 'fr') }}

It shows me :

30 décembre 2014 à 11:23:55

So one year later...
I tried with the date 2013-12-29 11:23:55 and it seems to not have a problem with this, so I think it's when the date is after the 30 december.

The problem seems to appear on this file :

DateTimeHelper line 140 when "return $this->fixCharset($formatter->format((int) $date->format('U')));" is called.

The problem seems to appear with this call specifically :

$formatter->format((int) $date->format('U'))

Sincerly,

Joyd.

InactiveScopeException when running cache:warmup

When running php app/console cache:warmup --env=prod -v the following exception is thrown:

[Symfony\Component\DependencyInjection\Exception\InactiveScopeException]
You cannot create a service ("request") of an inactive scope ("request").
Exception trace:
 () at /var/www/dev/webs/project/app/cache/prod/appProdDebugProjectContainer.php:1412
 appProdDebugProjectContainer->getRequestService() at /var/www/dev/webs/project/app/bootstrap.php.cache:194
 Symfony\Component\DependencyInjection\Container->get() at /var/www/dev/webs/project/app/cache/prod/appProdDebugProjectContainer.php:2590
 appProdDebugProjectContainer->getSonata_Intl_LocaleDetector_RequestService() at /var/www/dev/webs/project/app/bootstrap.php.cache:194
 Symfony\Component\DependencyInjection\Container->get() at /var/www/dev/webs/project/app/cache/prod/appProdDebugProjectContainer.php:2616
 appProdDebugProjectContainer->getSonata_Intl_Templating_Helper_LocaleService() at /var/www/dev/webs/project/app/bootstrap.php.cache:194
 Symfony\Component\DependencyInjection\Container->get() at /var/www/dev/webs/project/app/cache/prod/appProdDebugProjectContainer.php:3360
 appProdDebugProjectContainer->getTwigService() at /var/www/dev/webs/project/app/bootstrap.php.cache:194
 Symfony\Component\DependencyInjection\Container->get() at /var/www/dev/webs/project/app/cache/prod/appProdDebugProjectContainer.php:61
 appProdDebugProjectContainer->getAssetic_AssetManagerService() at /var/www/dev/webs/project/app/bootstrap.php.cache:194
 Symfony\Component\DependencyInjection\Container->get() at /var/www/dev/webs/project/vendor/bundles/Symfony/Bundle/AsseticBundle/CacheWarmer/AssetManagerCacheWarmer.php:33
 Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer->warmUp() at /var/www/dev/webs/project/vendor/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:47
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /var/www/dev/webs/project/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php:50
 Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand->execute() at /var/www/dev/webs/project/vendor/symfony/src/Symfony/Component/Console/Command/Command.php:237
 Symfony\Component\Console\Command\Command->run() at /var/www/dev/webs/project/vendor/symfony/src/Symfony/Component/Console/Application.php:193
 Symfony\Component\Console\Application->doRun() at /var/www/dev/webs/project/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:75
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/dev/webs/project/vendor/symfony/src/Symfony/Component/Console/Application.php:106
 Symfony\Component\Console\Application->run() at /var/www/dev/webs/project/app/console:22

Sonata\IntlBundle\Helper\BaseHelper::getLocale() problem

Environment

Sonata packages

show

$ composer show --latest 'sonata-project/*'
Info from https://repo.packagist.org: #StandWithUkraine
Color legend:
- patch or minor release available - update recommended
- major release available - update possible
- up to date version

Direct dependencies:
sonata-project/intl-bundle 2.13.0 2.13.0 Symfony SonataIntlBundle

Transitive dependencies:
Everything up to date

Symfony packages

show

$ composer show --latest 'symfony/*'
Color legend:
- patch or minor release available - update recommended
- major release available - update possible
- up to date version

Direct dependencies:
symfony/asset                      v5.4.7  v6.1.0  Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/browser-kit                v5.4.11 v6.1.3  Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
symfony/console                    v5.4.11 v6.1.3  Eases the creation of beautiful and testable command line interfaces
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 VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework
symfony/doctrine-messenger         v5.4.11 v6.1.3  Symfony Doctrine Messenger Bridge
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 expressions
symfony/flex                       v2.2.3  v2.2.3  Composer plugin for Symfony
symfony/form                       v5.4.11 v6.1.3  Allows to easily create, process and reuse HTML forms
symfony/framework-bundle           v5.4.11 v6.1.3  Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-client                v5.4.11 v6.1.3  Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/intl                       v5.4.11 v6.1.0  Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library
symfony/mailer                     v5.4.11 v6.1.3  Helps sending emails
symfony/maker-bundle               v1.45.0 v1.45.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/mime                       v5.4.11 v6.1.3  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 (email, SMS, ...)
symfony/phpunit-bridge             v6.1.3  v6.1.3  Provides utilities for PHPUnit, especially user deprecation notices management
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 object or array using a simple string notation
symfony/property-info              v5.4.11 v6.1.3  Extracts information about PHP class' properties using metadata of popular sources
symfony/proxy-manager-bridge       v5.4.6  v6.1.0  Provides integration for ProxyManager with various Symfony components
symfony/runtime                    v5.4.11 v6.1.3  Enables decoupling PHP applications from global state
symfony/security-bundle            v5.4.11 v6.1.3  Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/serializer                 v5.4.11 v6.1.3  Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
symfony/stopwatch                  v5.4.5  v6.1.0  Provides a way to profile code
symfony/string                     v5.4.11 v6.1.3  Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation                v5.4.11 v6.1.3  Provides tools to internationalize your application
symfony/twig-bundle                v5.4.8  v6.1.1  Provides a tight integration of Twig into the Symfony full-stack framework
symfony/validator                  v5.4.11 v6.1.3  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 information about the execution of any request
symfony/yaml                       v5.4.11 v6.1.3  Loads and dumps YAML files

Transitive dependencies:
symfony/amqp-messenger             v5.4.11 v5.4.11 Symfony AMQP extension Messenger Bridge
symfony/cache                      v5.4.11 v6.1.3  Provides an extended PSR-6, PSR-16 (and tags) implementation
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 validate configuration values of any kind
symfony/dependency-injection       v5.4.11 v6.1.3  Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts      v3.1.1  v3.1.1  A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge            v5.4.11 v6.1.3  Provides integration for Doctrine with various Symfony components
symfony/dom-crawler                v5.4.11 v6.1.3  Eases DOM navigation for HTML and XML documents
symfony/error-handler              v5.4.11 v6.1.3  Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher           v5.4.9  v6.1.0  Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v3.1.1  v3.1.1  Generic abstractions related to dispatching event
symfony/filesystem                 v5.4.11 v6.1.3  Provides basic utilities for the filesystem
symfony/finder                     v5.4.11 v6.1.3  Finds files and directories via an intuitive fluent interface
symfony/http-client-contracts      v2.5.2  v3.1.1  Generic abstractions related to HTTP clients
symfony/http-foundation            v5.4.11 v6.1.3  Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                v5.4.11 v6.1.3  Provides a structured process for converting a Request into a Response
symfony/messenger                  v5.4.11 v6.1.3  Helps applications send and receive messages to/from other applications or via message queues
symfony/monolog-bridge             v5.4.10 v6.1.2  Provides integration for Monolog with various Symfony components
symfony/options-resolver           v5.4.11 v6.1.0  Provides an improved replacement for the array_replace PHP function
symfony/password-hasher            v5.4.11 v6.1.3  Provides password hashing utilities
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 classes
symfony/polyfill-intl-idn          v1.26.0 v1.26.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.26.0 v1.26.0 Symfony polyfill for intl's Normalizer class and related functions
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+ features to lower PHP versions
symfony/polyfill-php80             v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81             v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/redis-messenger            v5.4.6  v5.4.6  Symfony Redis extension Messenger Bridge
symfony/routing                    v5.4.11 v6.1.3  Maps an HTTP request to a set of configuration variables
symfony/security-core              v5.4.11 v6.1.3  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.11 v6.1.3  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.11 v6.1.3  Provides integration for Twig with various Symfony components
symfony/var-dumper                 v5.4.11 v6.1.3  Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter               v5.4.10 v6.1.3  Allows exporting any serializable PHP data structure to plain PHP code

PHP version

$ php -v
PHP 8.1.9 (cli) (built: Aug  7 2022 23:18:24) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.9, Copyright (c) Zend Technologies

Subject

We upgraded from 2.12.x to 2.13, migrated from Templating\Helper to the new Helper classes and are experiencing problems with getLocale().

We have a class injects Sonata\IntlBundle\Helper\NumberFormatterInterface and calls formatDecimal(123), which results in this error:

Sonata\IntlBundle\Helper\BaseHelper::getLocale(): Return value must be of type string, null returned

We digged into the problem and it seems like BaseHelper::setLocale() is never called, which should be done by \Symfony\Component\HttpKernel\EventListener\LocaleAwareListener, which receives the locale aware listeners from \Symfony\Component\HttpKernel\DependencyInjection\RegisterLocaleAwareServicesPass via the kernel.locale_aware tag.

Seems like the Helpers are missing this tag. When we add it manually to config/intl.php, or add a ->autoconfigure() it works as expected.

Steps to reproduce

We installed a symfony 5.4 website skeleton, installed sonata-project/intl-bundle, and simply added this controller:

<?php

namespace App\Controller;

use Sonata\IntlBundle\Helper\NumberFormatterInterface;
use Symfony\Component\Routing\Annotation\Route;

class DefaultController
{
    private NumberFormatterInterface $formatter;

    public function __construct(
        NumberFormatterInterface $formatter,
    ) {
        $this->formatter = $formatter;
    }

    #[Route('/foo')]
    public function __invoke()
    {
        echo $this->formatter->formatDecimal(123);

        die;
    }
}

Which will yield the above error.

Cache number and date formatters?

Hi everybody.

While debugging a page with a complex layout (lots of dates and currency values in a big table) I noticed that a big part of the overhead is due to construction of \NumberFormatters (and \IntlDateFormatters). A solution would be to cache them in the getFormatter method, keyed by $culture and $style. The problem is that $attributes and $textAttributes would be set again and again on the same instance, instead of setting them every time on a new instance. The potential problem I see with that, is be if somebody somehow extended e.g. the NumberHelper and cached the formatter instance returned by the protected getFormatter method. This way its attributes would change without the extending class knowing that. If we see it strictly enough, this is a BC break. On the other hand, please look at the provided screenshot to see what's the performance impact. Just to get a sense, caching the number formatter in my case improved by 19% my page load time.

I guess I'm just asking whether you think caching that way is acceptable. If positive, I can do a pull request. What do you think?

schermata 2016-01-05 alle 22 10 37

schermata 2016-01-05 alle 22 20 31

Branch 2.0 not synced

see sonata-project/SonataAdminBundle#737 (comment) the templates are missing so it throws the exception

exception:

Object of class DateTime could not be converted to string

admin class:

        $listMapper
            ->add('createdAt', 'datetime')

entity class:

    /**
     * @var datetime $createdAt
     *
     * @ORM\Column(name="created_at", type="datetime")
     * @Gedmo\Timestampable(on="create")
     */
    private $createdAt;

Problem with twig datetime extension for twig 2.10

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/block-bundle        3.x-dev f18c789 Symfony SonataBlockBundle
sonata-project/cache               2.x-dev c81334f Cache library
sonata-project/core-bundle         3.17.0          Symfony SonataCoreBundle
sonata-project/datagrid-bundle     2.x-dev d13faff Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.x-dev 5c9bfa6 Doctrine2 behavioral extensions
sonata-project/intl-bundle         2.x-dev 8722cc1 Symfony SonataIntlBundle

Symfony packages

$ composer show --latest 'twig/*'
twig/extensions dev-master 9aefd75 Common additional features for Twig that do not directly belong in core
twig/twig       v2.10.0            Twig, the flexible, fast, and secure template language for PHP

PHP version

$ php -v
PHP 7.2.13 (cli) (built: Dec 29 2018 05:15:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.13, Copyright (c) 1999-2018, by Zend Technologies

Subject

When clearing cache an exception throws

Steps to reproduce

having some templates with date filter

$ bin/console cache:clear

Expected results

Success

Actual results

In FunctionExpression.php line 19:
                                                                                                                                                                 
  [Symfony\Component\Debug\Exception\FatalThrowableError]                                                                                                        
  Type error: Argument 3 passed to Twig\Node\Expression\FunctionExpression::__construct() must be of the type integer, object given, called in /var/www/html/ve  
  ndor/twig/twig/src/ExpressionParser.php on line 556                                                                                                            
                                                                                                                                                                 

Exception trace:
 () at /var/www/html/vendor/twig/twig/src/Node/Expression/FunctionExpression.php:19
 Twig\Node\Expression\FunctionExpression->__construct() at /var/www/html/vendor/twig/twig/src/ExpressionParser.php:556
 Twig\ExpressionParser->parseFilterExpressionRaw() at /var/www/html/vendor/twig/twig/src/ExpressionParser.php:539
 Twig\ExpressionParser->parseFilterExpression() at /var/www/html/vendor/twig/twig/src/ExpressionParser.php:397
 Twig\ExpressionParser->parsePostfixExpression() at /var/www/html/vendor/twig/twig/src/ExpressionParser.php:289
 Twig\ExpressionParser->parsePrimaryExpression() at /var/www/html/vendor/twig/twig/src/ExpressionParser.php:175
 Twig\ExpressionParser->getPrimary() at /var/www/html/vendor/twig/twig/src/ExpressionParser.php:70
 Twig\ExpressionParser->parseExpression() at /var/www/html/vendor/twig/twig/src/Parser.php:142
 Twig\Parser->subparse() at /var/www/html/vendor/twig/twig/src/TokenParser/IfTokenParser.php:39
 Twig\TokenParser\IfTokenParser->parse() at /var/www/html/vendor/twig/twig/src/Parser.php:185
 Twig\Parser->subparse() at /var/www/html/vendor/twig/twig/src/Parser.php:98
 Twig\Parser->parse() at /var/www/html/vendor/twig/twig/src/Environment.php:563
 Twig\Environment->parse() at /var/www/html/vendor/twig/twig/src/Environment.php:595
 Twig\Environment->compileSource() at /var/www/html/vendor/twig/twig/src/Environment.php:408
 Twig\Environment->loadClass() at /var/www/html/vendor/twig/twig/src/Environment.php:381
 Twig\Environment->loadTemplate() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php:77
 Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:52
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:222
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:134
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:987
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:86
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:74
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:28

Why intl bundle conflicts with user bundle ?

Environment

Sonata packages

$ composer show sonata-project/*
sonata-project/admin-bundle              3.18.0             The missing Symfony Admin Generator
sonata-project/block-bundle              3.3.2              Symfony SonataBlockBundle
sonata-project/cache                     1.0.7              Cache library
sonata-project/classification-bundle     3.3.0              Symfony SonataClassificationBundle
sonata-project/core-bundle               3.3.0              Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2.1              Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2              Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.1.4              Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.2.0              Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.7.1              Lightweight Exporter library
sonata-project/media-bundle              3.5.1              Symfony SonataMediaBundle
sonata-project/notification-bundle       3.1.0              Symfony SonataNotificationBundle
sonata-project/user-bundle               dev-master d1729c7 Symfony SonataUserBundle

Symfony packages

$ composer show symfony/*
symfony/assetic-bundle     v2.8.1  Integrates Assetic into Symfony2
symfony/monolog-bundle     v2.12.1 Symfony MonologBundle
symfony/phpunit-bridge     v3.2.4  Symfony PHPUnit Bridge
symfony/polyfill-intl-icu  v1.3.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.3.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.3.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.3.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util      v1.3.0  Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.0  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.5.4  Symfony SwiftmailerBundle
symfony/symfony            v3.2.8  The Symfony PHP framework

PHP version

$ php -v
PHP 7.0.0 (cli) (built: Dec  3 2015 09:31:42) ( ZTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

Subject

Steps to reproduce

Expected results

Actual results

$ composer require sonata-project/intl-bundle
Using version ^2.3 for sonata-project/intl-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- sonata-project/intl-bundle 2.3.0 conflicts with sonata-project/user-bundle[4.x-dev].
- sonata-project/intl-bundle 2.3.0 conflicts with sonata-project/user-bundle[4.x-dev].
- sonata-project/intl-bundle 2.3.0 conflicts with sonata-project/user-bundle[4.x-dev].
- Installation request for sonata-project/intl-bundle ^2.3 -> satisfiable by sonata-project/intl-bundle[2.3.0].
- Installation request for sonata-project/user-bundle ^4.0@dev -> satisfiable by sonata-project/user-bundle[4.x-dev].

Installation failed, reverting ./composer.json to its original content.

Wrong test on version Kernel

All tests are wrong

 if (version_compare(Kernel::VERSION, '2.1.0', ...

Kernel::VERSION is 2.1.0-DEV

 if (version_compare(substr(Kernel::VERSION,0,5), '2.1.0', ...

Detected in RequestDetector and SonataIntlExtension

Add support for NumberFormatter symbol parameter

Currently there is no way to change symbol attributes using the number_format_* methods in Twig templates. This feature can be useful in various cases, for example when the user wants to change the thousand separator or the decimal separator. OroCRM properly implemented this feature in their LocaleBundle, would it be possible to add it to SonataIntlBundle too?

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.