Commit Graph

43748 Commits

Author SHA1 Message Date
Roromix
50673c5321 [Security] LoginLink with specific locale 2021-03-23 22:14:25 +01:00
Nicolas Grekas
4e3ae2d58e feature #40489 [Serializer] Add a Custom End Of Line in CSV File (xfifix)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Serializer] Add a Custom End Of Line in CSV File

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| License       | MIT
| Doc PR        | -

Commits
-------

20f03677e3 [Serializer] Add a Custom End Of Line in CSV File
2021-03-23 22:11:04 +01:00
Nicolas Grekas
7f640123cb feature #40554 [Contracts] Add TranslatorInterface::getLocale() (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Contracts] Add `TranslatorInterface::getLocale()`

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | yes
| Tickets       | Fix #40380
| License       | MIT
| Doc PR        | -

As discussed in https://github.com/symfony/symfony/issues/40380

Commits
-------

45d9a36794 [Contracts/Translation] Add `TranslatorInterface::getLocale()`
2021-03-23 22:10:30 +01:00
Nicolas Grekas
45b53fee14 feature #40556 Add #[As-prefix] to service attributes (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

Add `#[As-prefix]` to service attributes

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

This PR renames all existing attributes with the `As` prefix, as I proposed several times already.

This should help autocompletion, and it's required to not collide with existing class names (eg the `Command` class, but also the old `Controller` class, etc.)

I think this `As` prefix is a convention for the better.

Commits
-------

4f1318963a Add `#[As-prefix]` to service attributes
2021-03-23 22:09:38 +01:00
Nicolas Grekas
ea58a157e1 Merge branch '5.2' into 5.x
* 5.2:
  [travis] remove cache of composer.lock for deps=low
  Fix comment with typo
2021-03-23 22:05:31 +01:00
Nicolas Grekas
36cc161adc Merge branch '4.4' into 5.2
* 4.4:
  [travis] remove cache of composer.lock for deps=low
  Fix comment with typo
2021-03-23 22:05:22 +01:00
sebpacz
96a05daf7e Fix comment with typo 2021-03-23 21:55:00 +01:00
Nicolas Grekas
8975f833ae Merge branch '5.2' into 5.x
* 5.2:
  fix reported class when deprecated method is static
2021-03-23 21:42:45 +01:00
Nicolas Grekas
5e9644fae4 Merge branch '4.4' into 5.2
* 4.4:
  fix reported class when deprecated method is static
2021-03-23 21:42:04 +01:00
Christian Flothmann
aa80df609f fix reported class when deprecated method is static 2021-03-23 21:33:06 +01:00
Robin Chalas
3640a889d5 feature #40555 [HttpKernel] Add #[AsController] attribute for declaring standalone controllers on PHP 8 (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[HttpKernel] Add `#[AsController]` attribute for declaring standalone controllers on PHP 8

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

This PR adds an `#[AsController]` attribute to allow autoconfiguring controllers even when they don't extend `AbstractController`. This should allow removing the line about `controller.service_arguments` in `services.yaml` to cover this need (but that is noise to most.)

Commits
-------

437f5feb45 [HttpKernel] Add `#[AsController]` attribute for declaring listeners on PHP 8
2021-03-23 21:08:54 +01:00
Nicolas Grekas
019e29b339 Merge branch '5.2' into 5.x
* 5.2:
  [travis] use packagist API v2
  [translation] Fix update existing key with existing +int-icu domain
  [Contracts] Fix branch name in README.md links
2021-03-23 20:34:00 +01:00
Nicolas Grekas
7a972c43c2 Merge branch '4.4' into 5.2
* 4.4:
  [travis] use packagist API v2
  [translation] Fix update existing key with existing +int-icu domain
  [Contracts] Fix branch name in README.md links
2021-03-23 20:33:48 +01:00
Nicolas Grekas
4f1318963a Add #[As-prefix] to service attributes 2021-03-23 18:57:16 +01:00
Nicolas Grekas
437f5feb45 [HttpKernel] Add #[AsController] attribute for declaring listeners on PHP 8 2021-03-23 18:56:31 +01:00
Nicolas Grekas
45d9a36794 [Contracts/Translation] Add TranslatorInterface::getLocale() 2021-03-23 17:28:16 +01:00
Nicolas Grekas
1665555dd5 bug #40552 [Translation] Fix update existing key with existing +int-icu domain (Alexis)
This PR was merged into the 4.4 branch.

Discussion
----------

[Translation] Fix update existing key with existing +int-icu domain

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |  none
| License       | MIT
| Doc PR        | none

Using php-translation webui interface, I was trying to update an existing +int-icu domain but a regular domain was created and the existing key wasn't updated. Looks like in the method I modified, we should have been looking for a potential domain+intl-icu domain and try update it first

Commits
-------

2a196ca0dc [translation] Fix update existing key with existing +int-icu domain
2021-03-23 17:25:13 +01:00
Alexis
2a196ca0dc [translation] Fix update existing key with existing +int-icu domain 2021-03-23 17:25:01 +01:00
Robin Chalas
c5c47f11a4 [Contracts] Fix branch name in README.md links 2021-03-23 16:25:38 +01:00
Robin Chalas
c752257be3 Merge branch '5.2' into 5.x
* 5.2:
  [Console] minor fix
  [Command] fix emojis messing up the line width
  [Validator] Avoid triggering the autoloader for user-input values
  Hardening Security - Unserialize DumpDataCollector
  Security hardening - Rate limiter
  [FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized
  Fixed parsing deprecated definitions without message key
  improve login throttling rate limiter requirement message
  [HttpClient] remove using $http_response_header
  [Security] Handle properly 'auto' option for remember me cookie security
2021-03-23 15:20:07 +01:00
Robin Chalas
2da27bbd27 feature #40550 [Notifier] Move abstract test cases to namespace (OskarStark)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Notifier] Move abstract test cases to  namespace

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no (only fixes builds)
| New feature?  | yes (not sure about a changeling entry)
| Deprecations? | no
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | no

This enables BC promise for the abstract test classes, like for other ones.

As we ignore current `/Tests` directory in `.gitattributes`, builds will fail if `symfony/notifier` is installed as dist.

Commits
-------

33ba3c755d [Notifier] Move abstract test cases to  namespace
2021-03-23 15:00:06 +01:00
Nicolas Grekas
e494b389f3 bug #40541 Fixed parsing deprecated definitions without message key (adamwojs)
This PR was merged into the 5.2 branch.

Discussion
----------

Fixed parsing deprecated definitions without message key

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

### Steps to reproduce

1. Create service/alias definition and mark it as deprecated without specifying message key as shown in https://symfony.com/doc/5.2/service_container/alias_private.html#deprecating-service-aliases. For example:

```yaml
services:
    service_without_deprecation_message:
        class: Foo
        deprecated:
            package: vendor/package
            version: 1.1

    alias_without_deprecation_message:
        alias: foobar
        deprecated:
            package: vendor/package
            version: 1.1
```

2. Clear cache by running `php bin/console cache:clear`

### Actual behaviour

`Symfony\Component\Config\Exception\LoaderLoadException` exception is thrown with the following message: `Warning: Undefined array key "message" (...)`

See https://gist.github.com/adamwojs/5bac85d4326d8fbe6f52a357fa6e57e6 for full stactrace.

### Excepted behaviour

Given definitions are loaded correctly. Default service/alias deprecation message is used as shown in linked documentation page.

Commits
-------

d585b64953 Fixed parsing deprecated definitions without message key
2021-03-23 13:46:26 +01:00
Nicolas Grekas
88d222d856 Merge branch '4.4' into 5.2
* 4.4:
  [Console] minor fix
  [Validator] Avoid triggering the autoloader for user-input values
  Hardening Security - Unserialize DumpDataCollector
  [HttpClient] remove using $http_response_header
  [Security] Handle properly 'auto' option for remember me cookie security
2021-03-23 13:45:44 +01:00
Nicolas Grekas
55bd7f4be4 feature #40530 [Uid] Handle predefined namespaces keywords "dns", "url", "oid" and "x500" (fancyweb)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Uid] Handle predefined namespaces keywords "dns", "url", "oid" and "x500"

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Before: `uuid:generate --name-based="https://symfony.com" --namespace=6ba7b811-9dad-11d1-80b4-00c04fd430c8`
After: `uuid:generate --name-based="https://symfony.com" --namespace=url`

Same for FWB configuration.

Commits
-------

ede46ac13a [Uid] Handle predefined namespaces keywords "dns", "url", "oid" and "x500"
2021-03-23 13:33:35 +01:00
Nicolas Grekas
9a8e2c2625 bug #40537 [Security] Handle properly 'auto' option for remember me cookie security (fliespl)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Handle properly 'auto' option for remember me cookie security

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40471
| License       | MIT
| Doc PR        | n/a

Manually setting remember_me cookie secure as auto is still is being set as secure one even if used over http.

This PR fixes this behaviour by converting auto to null prior setting it up for service.

Commits
-------

2bcf69c071 [Security] Handle properly 'auto' option for remember me cookie security
2021-03-23 13:31:44 +01:00
Nicolas Grekas
7eb4db6d9d [Console] minor fix 2021-03-23 13:24:21 +01:00
Marion Hurteau
36b36dcecc [Command] fix emojis messing up the line width
add tests + removed irrelevant method
2021-03-23 13:19:11 +01:00
Nicolas Grekas
689056ef7f bug #40506 [Validator] Avoid triggering the autoloader for user-input values (Seldaek)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Validator] Avoid triggering the autoloader for user-input values

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Following-up to https://twitter.com/seldaek/status/1372450636361502721 - mostly to see if the build passes or if this breaks some undocumented/unclear-to-me assumptions.

Essentially using the `Valid` constraint should only validate objects if they exist as objects. If a user sends a string and that gets assigned to a property, `Valid` should not attempt autoloading that user-given string.

As far as I can tell, this is used in two places:

- acb32dd396/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php (L364-L365) where non-objects are anyway ignored, so this change is harmless there.
- acb32dd396/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php (L652-L660) where it's explicitly passing anything in there to get the proper exception, so my change makes sure that exception is thrown *before* autoloading attempts. I am just not 100% sure if there are cases where validateGenericNode will receive a class name as a string to validate in $value. I can't imagine why it would but that doesn't mean it's true.

Commits
-------

e45eb23ba2 [Validator] Avoid triggering the autoloader for user-input values
2021-03-23 12:26:37 +01:00
Jordi Boggiano
e45eb23ba2 [Validator] Avoid triggering the autoloader for user-input values 2021-03-23 12:25:54 +01:00
Nicolas Grekas
4c2f77e5b1 bug #40544 [FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized (kbond)
This PR was merged into the 5.2 branch.

Discussion
----------

[FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

Fixes a bug introduced in #40368. When `TestBrowserToken` in unserialized, `$firewallName` is `null` so trying to access it via `getFirewallName` throws a `TypeError`.

Commits
-------

8ba12ece57 [FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized
2021-03-23 12:16:14 +01:00
Oskar Stark
33ba3c755d [Notifier] Move abstract test cases to namespace
This enables BC promise for the abstract test classes, like for other ones.

As we ignore current `/Tests` directory in `.gitattributes`, builds will fail if `symfony/notifier` is installed as dist.
2021-03-23 10:42:26 +01:00
Jérémy Derussé
214dbfec51
Hardening Security - Unserialize DumpDataCollector 2021-03-23 09:46:32 +01:00
Jérémy Derussé
e61553af4b
Security hardening - Rate limiter 2021-03-22 20:26:15 +01:00
Nyholm
415c2a0b47 [WebLink] Remove symfony/http-foundation dependency 2021-03-22 16:30:12 +01:00
Kevin Bond
8ba12ece57
[FrameworkBundle] ensure TestBrowserToken::$firewallName is serialized 2021-03-22 10:43:01 -04:00
Alexander M. Turek
1fc2a04e00 Rename master request to main request 2021-03-22 14:14:48 +01:00
Adam Wójs
d585b64953 Fixed parsing deprecated definitions without message key 2021-03-22 12:10:24 +01:00
Jesse Rushlow
6958bdc0be
improve login throttling rate limiter requirement message 2021-03-22 06:08:44 -04:00
Nicolas Grekas
b78f1dffc2 [HttpClient] remove using $http_response_header 2021-03-22 10:43:50 +01:00
flies
2bcf69c071 [Security] Handle properly 'auto' option for remember me cookie security 2021-03-22 09:54:48 +01:00
Alexander M. Turek
7873574335 Merge branch '5.2' into 5.x
* 5.2:
  [UID] refer to AbstractUid instead of "parent"
2021-03-22 02:11:47 +01:00
Thomas Calvet
ede46ac13a [Uid] Handle predefined namespaces keywords "dns", "url", "oid" and "x500" 2021-03-21 18:34:32 +01:00
Nyholm
abe4ee5b56
[UID] refer to AbstractUid instead of "parent" 2021-03-21 17:15:38 +01:00
Nyholm
4f486e850a
[Runtime] Dont use "parent" as type hint 2021-03-20 13:56:11 +01:00
Nicolas Grekas
1b93740325 CS fix 2021-03-19 19:00:13 +01:00
Thomas Calvet
2135fc3e71 [Uid] [GenerateUuidCommand] Compute a new \DateTimeImmutable every loop 2021-03-19 18:32:35 +01:00
Nyholm
6c0786b579
feature #40513 [Runtime] make GenericRuntime ... generic (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Runtime] make GenericRuntime ... generic

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

This PR will allow #40436 to move to https://github.com/symfony/psr-http-message-bridge
For the record, it builds on a prototype I wrote almost one year ago at https://github.com/tchwork/bootstrapper.

This PR makes the `GenericRuntime` implementation able to auto-discover runtime implementations for specific types.

It uses the autoloader for the discovery: when a closure-app requires or returns a type `Vendor\Foo`, it will use a convention and check if the class `Symfony\Runtime\Vendor\FooRuntime` exists. If yes, it will use it to resolve the corresponding type. Such runtime classes have to extend `GenericRuntime` so that they can use the protected API it provides. This requirement is aligned with the fact that the very convention proposed here is an implementation detail that works when using a `GenericRuntime` as the main runtime (This behavior can be overridden by providing explicit entries in the new `runtimes` option when booting the `GenericRuntime`.)

`SymfonyRuntime` can be used as both the main runtime or a type-specific runtime:
- when used as the main runtime, it configures the typical global-state for Symfony and has a fast codepath for Symfony types, while still being generic.
- it can also be used in another runtime as a way to resolve Symfony types (would typically be useful to #40436 for running Console apps in a PSR-based web app.)

Commits
-------

33e371e24d [Runtime] make GenericRuntime ... generic
2021-03-19 16:55:34 +01:00
Nicolas Grekas
485c896b4b Merge branch '5.2' into 5.x
* 5.2:
  [HttpKernel] do is_file check before include
  [PhpUnitBridge] fix reporting deprecations from DebugClassLoader
  [FrameworkBundle] skip deprecation in integration tests
  enable HTTP method overrides as early as possible with the HTTP cache
2021-03-19 12:02:33 +01:00
Nicolas Grekas
bd9e2208a0 Merge branch '4.4' into 5.2
* 4.4:
  [HttpKernel] do is_file check before include
  [PhpUnitBridge] fix reporting deprecations from DebugClassLoader
  [FrameworkBundle] skip deprecation in integration tests
2021-03-19 12:02:08 +01:00
Nicolas Grekas
a2d534ccf8 minor #40516 [HttpKernel] Add is_file() check before include (burned42)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Add is_file() check before include

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes (?)
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

I recently noticed that on every deployment I got warnings reported by sentry from the `cache:clear` command.

> Warning: include(/var/www/html/var/cache/pro_/App_KernelProdContainer.php): failed to open stream: No such file or directory

In `Symfony\Component\HttpKernel\Kernel` [line 469](https://github.com/symfony/symfony/blob/5.x/src/Symfony/Component/HttpKernel/Kernel.php#L469)
 (on 4.4 it's on [line 536](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/HttpKernel/Kernel.php#L536))

This is because the code tries to include the `$cachePath` without checking if it exists/is a file first. It seems like something similar was fixed some time ago already (https://github.com/symfony/symfony/pull/27249) some lines above.

This PR fixes the mentioned warnings for me.

I'm running on Symfony 5.2.5 at the moment, but the docs said that bugfixes should target branch 4.4 and new features should target 5.x, and I guess this could rather be seen as a bugfix than a new feature, so I branched off of 4.4 and also set this as target for the PR, I hope that's correct.

Commits
-------

8efcc17573 [HttpKernel] do is_file check before include
2021-03-19 12:01:36 +01:00
Nicolas Grekas
08306722ba bug #40508 [PhpUnitBridge] fix reporting deprecations from DebugClassLoader (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] fix reporting deprecations from DebugClassLoader

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40400
| License       | MIT
| Doc PR        | -

Commits
-------

cb68aeab38 [PhpUnitBridge] fix reporting deprecations from DebugClassLoader
2021-03-19 11:58:33 +01:00
Romain
20f03677e3 [Serializer] Add a Custom End Of Line in CSV File 2021-03-19 11:55:40 +01:00
Nicolas Grekas
33e371e24d [Runtime] make GenericRuntime ... generic 2021-03-19 11:40:44 +01:00
Bernd Stellwag
8efcc17573 [HttpKernel] do is_file check before include
Trying to include a file that doesn't exist issues a warning. Doing an
is_file check beforehand should prevent those warnings.
2021-03-19 08:57:35 +01:00
Alexander M. Turek
c8b48d8bbb feature #40430 [Form] Add "form_attr" FormType option (cristoforocervino)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Form] Add "form_attr" FormType option

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      |no
| New feature?  | yes
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | [#15108](https://github.com/symfony/symfony-docs/pull/15108)

## What is this about

This PR add support for [`form` attribute](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form) to Symfony Form ([browser compatibility](https://caniuse.com/form-attribute)).

The `form` attribute allows form elements to override their associated form (which is their nearest ancestor form element by default). This is extremely useful to solve **nested form problem** and allows **form children** to be **rendered outside form tag** while still working as expected.

## New "form_attr" FormType option

#### form_attr
**type**: `bool` or `string` **default**: `false`

If set to `true` on a **root form**, adds [`form` attribute](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form) on every children with their root **form id**.
This allows you to render form children outside the form tag and avoid **nested form problem** in some situations while keeping the form working properly.

If set to `true` on a **child**, adds [`form` attribute](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form) on it with its **root form id**.
This allows you to render **that child** outside the form tag and avoid **nested form problem** in some situations while keeping the form working properly.

If root form has no `id` (this may happen by create an *unnamed* form), you can set it to a `string` identifier to be used at `FormView` level to link children and root form anyway.

## Usage on Root Form Example

#### Form Type
Enable the feature by setting `form_attr` to `true` on the root form.

```php
use Symfony\Component\Form\Extension\Core\Type;

class ListFilterType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('search', Type\SearchType::class)
            ->add('orderBy', Type\ChoiceType::class, [
                'choices' => [
                    // ...
                ],
            ])
            ->add('perPage', Type\ChoiceType::class, [
                'choices' => [
                    // ...
                ],
            ])
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefault('form_attr', true); // <--- Set this to true
    }
}

```

#### Twig

The following Twig template **works properly** even if form children are **outside** their form tag ([browser compatibility](https://caniuse.com/form-attribute)).

```twig

<div class="header-filters">
    {{ form_errors(form) }}
    {{ form_row(form.search) }} {# has attribute form="list_filter" #}
    {{ form_row(form.orderBy) }} {# has attribute form="list_filter" #}
</div>

<!-- -->
<!-- Some other HTML content, like a table or even another Symfony form -->
<!-- -->

<div class="footer-filters">
    {{ form_row(form.perPage) }} {# has attribute form="list_filter" #}
</div>
{{ form_start(form) }} {# id="list_filter" #}
{{ form_end(form) }}
```
 Every form elements work properly even outside form tag.

## Usage on Form Child Example

Enable the feature by setting `form_attr` to `true` on selected child.

```php
use Symfony\Component\Form\Extension\Core\Type;

class ListFilterType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('search', Type\SearchType::class)
            ->add('orderBy', Type\ChoiceType::class, [
                'choices' => [
                    // ...
                ],
            ])
            ->add('perPage', Type\ChoiceType::class, [
                'form_attr' => true,  // <--- Set this to true
                'choices' => [
                    // ...
                ],
            ])
    }
}

```

#### Twig

The following Twig template **works properly** even if `form.perPage` is **outside** form tag ([browser compatibility](https://caniuse.com/form-attribute)).

```twig

<div class="header-filters">
    {{ form_start(form) }} {# id="list_filter" #}
        {{ form_errors(form) }}
        {{ form_row(form.search) }}
        {{ form_row(form.orderBy) }}
    {{ form_end(form, {'render_rest': false}) }}
</div>

<!-- -->
<!-- Some other HTML content, like a table or even another Symfony form -->
<!-- -->

<div class="footer-filters">
    {{ form_row(form.perPage) }} {# has attribute form="list_filter" #}
</div>
```
 `form.perPage` element work properly even outside form tag.

Commits
-------

5f913cec74 [Form] Add "form_attr" FormType option
2021-03-18 16:04:16 +01:00
Cristoforo Cervino
5f913cec74 [Form] Add "form_attr" FormType option 2021-03-18 16:04:09 +01:00
Alexander M. Turek
1c22e6a0fc feature #38488 [Validator] Add normalizer option to Unique constraint (henry2778)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Validator] Add normalizer option to Unique constraint

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | #37451
| License       | MIT
| Doc PR        | todo

Hello! Reopening my PR #37507 with target branch `5.x`

This PR is about https://github.com/symfony/symfony/issues/37451. The idea is to make that constraint more flexible and able to process business rules, especially when working with objects. We can think about it as the similar feature in UniqueEntity constraint, when we declare on which attributes we are applying the constraint. But in our case it is more general - we pass a callable with whatever logic we want to apply to collection elements before we apply 'uniqueness check' :)

Looks like no BC breaks. Thanks! :)

Commits
-------

44e1e8bc9b [Validator] Add normalizer option to Unique constraint
2021-03-18 15:44:46 +01:00
Andrii Popov
44e1e8bc9b [Validator] Add normalizer option to Unique constraint 2021-03-18 15:44:36 +01:00
Nicolas Grekas
cb68aeab38 [PhpUnitBridge] fix reporting deprecations from DebugClassLoader 2021-03-18 14:54:07 +01:00
Nicolas Grekas
5dd56a61a3 [FrameworkBundle] skip deprecation in integration tests 2021-03-18 10:22:03 +01:00
Christian Flothmann
93e9337382 enable HTTP method overrides as early as possible with the HTTP cache 2021-03-17 21:40:29 +01:00
Christian Flothmann
acb32dd396 Merge branch '5.2' into 5.x
* 5.2:
  fix version constraint
2021-03-17 21:38:37 +01:00
Christian Flothmann
e3788b68be fix version constraint 2021-03-17 21:31:43 +01:00
Nicolas Grekas
4b312ab06c Merge branch '5.2' into 5.x
* 5.2:
  Fix test
2021-03-17 18:12:23 +01:00
Nicolas Grekas
763edf9c92 Fix test 2021-03-17 18:12:15 +01:00
Nicolas Grekas
54cb7ec0cc Merge branch '5.2' into 5.x
* 5.2:
  CS fix
2021-03-17 18:02:51 +01:00
Nicolas Grekas
00036b934b Merge branch '4.4' into 5.2
* 4.4:
  CS fix
2021-03-17 18:02:05 +01:00
Nicolas Grekas
6a6274ca89 CS fix 2021-03-17 18:01:41 +01:00
Nicolas Grekas
285cdb0ecd bug #40498 [DebugBundle] Remove warning of ServerDumpPlaceholderCommand in console (DemigodCode)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[DebugBundle] Remove warning of ServerDumpPlaceholderCommand in console

| Q             | A
| ------------- | ---
| Branch?       | 5.2.5
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40495
| License       | MIT
| Doc PR        |

In 5.2.5 the console commands are lazy. (https://github.com/symfony/symfony/pull/39851)
With this change the ServerDumpCommand::$defaultName is used which isn't set in the placeholder command.
If no vardump-server in debug.dump_destination is defined, this will lead to a warning and not adding the command to the console list.

Commits
-------

37b2a19989 [DebugBundle] Add $defaultName to PlaceholderCommand
2021-03-17 17:59:56 +01:00
DemigodCode
37b2a19989 [DebugBundle] Add $defaultName to PlaceholderCommand 2021-03-17 17:58:09 +01:00
Nicolas Grekas
78fccbeb4c Merge branch '5.2' into 5.x
* 5.2:
  [Console] Fix line wrapping for decorated text in block output
  [Inflector] Fixed pluralize "coupon"
  [PhpUnitBridge] fix compat with symfony/debug
  [VarDumper] Adds support for ReflectionUnionType to VarDumper
  Correctly clear lines for multi-line progress bar messages.
  [Security] Add XML support for authenticator manager
2021-03-17 17:56:09 +01:00
Nicolas Grekas
98fce3ee7f Merge branch '4.4' into 5.2
* 4.4:
  [Console] Fix line wrapping for decorated text in block output
  [Inflector] Fixed pluralize "coupon"
  [PhpUnitBridge] fix compat with symfony/debug
  [VarDumper] Adds support for ReflectionUnionType to VarDumper
  Correctly clear lines for multi-line progress bar messages.
2021-03-17 17:55:51 +01:00
Nicolas Grekas
9030fd368b bug #40348 [Console] Fix line wrapping for decorated text in block output (grasmash)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Console] Fix line wrapping for decorated text in block output

| Q             | A
| ------------- | ---
| Branch?       |
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

Fixed bug that caused decorated text to be wrapped too early in SymfonyStyle->block().

Commits
-------

760be88310 [Console] Fix line wrapping for decorated text in block output
2021-03-17 17:22:13 +01:00
Matthew Grasmick
760be88310 [Console] Fix line wrapping for decorated text in block output 2021-03-17 17:22:06 +01:00
Nyholm
d3412e919f [Inflector] Fixed pluralize "coupon" 2021-03-17 17:19:54 +01:00
Nicolas Grekas
7678d62f75 bug #40494 [PhpUnitBridge] fix compat with symfony/debug (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] fix compat with symfony/debug

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40390
| License       | MIT
| Doc PR        | -

Best reviewed [ignoring whitespaces](https://github.com/symfony/symfony/pull/40494/files?w=1).

Commits
-------

35dd54a654 [PhpUnitBridge] fix compat with symfony/debug
2021-03-17 12:14:50 +01:00
Nicolas Grekas
35dd54a654 [PhpUnitBridge] fix compat with symfony/debug 2021-03-17 09:57:09 +01:00
Fabien Potencier
692c6296d7 minor #40437 [Runtime] Remove "docs" from readme (Nyholm)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Runtime] Remove "docs" from readme

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/15081

Make the readme of the Runtime component link to the docs. This PR is blocked by the doc PR.

Commits
-------

6f4552fcec [Runtime] Remove "docs" from readme
2021-03-17 07:33:10 +01:00
Fabien Potencier
550489aa8e bug #40453 [VarDumper] Adds support for ReflectionUnionType to VarDumper (Michael Nelson, michaeldnelson)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[VarDumper] Adds support for ReflectionUnionType to VarDumper

Fixes a bug with VarDumper when dumping a ReflectionUnionType.
> PHP Error:  Call to undefined method ReflectionUnionType::isBuiltin()

Notes:
* One of the existing tests relies on its position in the test file. I had to modify its expected line number.
* There is an existing trailing space around line 367 in an expected value.
  I'm not sure if this was left for BC reasons but it seems like a bug if the dumper is leaving trailing spaces.

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

This commit fixes a crash when dumping ReflectionUnionType.  The code is minimal but uses a few extra lines to preserve key order for bc and consistency.  Additionally, there is an else condition that is currently unreachable but is defensive should they add additional subtypes of ReflectionType. Tests are included.  Please let me know if you have any questions or suggestions.  Thanks for Symfony it's a wonderful project.

Commits
-------

1a11491f6e [VarDumper] Adds support for ReflectionUnionType to VarDumper
2021-03-17 07:30:13 +01:00
Michael Nelson
1a11491f6e [VarDumper] Adds support for ReflectionUnionType to VarDumper 2021-03-17 07:30:06 +01:00
Fabien Potencier
9630c2fb57 Fix CS 2021-03-17 07:23:45 +01:00
Fabien Potencier
9287099c57 minor #40488 [Mailer] Add supported auth modes to exception (liayn)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Mailer] Add supported auth modes to exception

| Q             | A
| ------------- | ---
| Branch?       | 4.4+
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

If there is no match for the available authenticators the thrown exception now includes the supported auth methods as reported by the server.

Commits
-------

d9c99d86ab [Mailer] Add supported auth modes to exception
2021-03-17 07:21:46 +01:00
Fabien Potencier
d70c0988d3 bug #40492 [Security] Fix BC layer (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Security] Fix BC layer

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Tests were broken because no password hasher was configured for the new `InMemoryUser` class in configs on lower branches.
This PR fixes it by making the new class extend the deprecated one, so that the password hasher factory is able to find a password hasher for it (instanceof-based match).

Commits
-------

2d7f7b5072 [Security] Fix BC layer
2021-03-17 07:06:36 +01:00
Fabien Potencier
50591a771b Fix CS 2021-03-17 07:04:35 +01:00
Wouter de Jong
99cf2a3a71 [Security] Disallow passing a UserInterface to Passport
This was deprecated in 5.2, with a warning that support would be dropped in 5.3
(due to the experimental state).
2021-03-17 07:03:24 +01:00
Matthew Grasmick
8ada55c07c Correctly clear lines for multi-line progress bar messages. 2021-03-16 22:19:58 -04:00
Robin Chalas
2d7f7b5072 [Security] Fix BC layer 2021-03-16 23:18:28 +01:00
Nicolas Grekas
49d23d4813 minor #40484 [DependencyInjection] accept null index in #[TaggedItem] (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[DependencyInjection] accept null index in #[TaggedItem]

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

As hinted by @stof in https://github.com/symfony/symfony/pull/40248#discussion_r595065941

Commits
-------

6d16fac703 [DI] accept null index in #[TaggedItem]
2021-03-16 20:14:20 +01:00
Nicolas Grekas
6d16fac703 [DI] accept null index in #[TaggedItem] 2021-03-16 20:13:40 +01:00
Fabien Potencier
db87d72869 feature #40443 [Security] Rename User to InMemoryUser (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Security] Rename User to InMemoryUser

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | yes
| Tickets       | Closes #26348
| License       | MIT
| Doc PR        | -

This PR aims to clarify that the `User` class should only be used by the `InMemoryUserProvider`, as documented:
c06a76c384/src/Symfony/Component/Security/Core/User/User.php (L15-L17)
It also renames `UserChecker` to `InMemoryUserChecker` because it only works with the in-memory user class:
c06a76c384/src/Symfony/Component/Security/Core/User/UserChecker.php (L31-L32)

Commits
-------

55b51d3f90 [Security] Rename User to InMemoryUser
2021-03-16 19:12:12 +01:00
Wouter de Jong
77fb0eb0a1 [Security] Add XML support for authenticator manager 2021-03-16 19:11:03 +01:00
Markus Klein
d9c99d86ab [Mailer] Add supported auth modes to exception
If there is no match for the available authenticators the thrown
exception now includes the supported auth methods as reported by the server.
2021-03-16 14:41:21 +01:00
Nicolas Grekas
7cc5cef1c3 feature #40468 Deprecate configuring tag names and service ids in compiler passes (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

Deprecate configuring tag names and service ids in compiler passes

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Tickets       | -
| License       | MIT
| Doc PR        | -

This PR is aimed at reducing the code complexity by hardcoding the name of tags and service ids that compiler passes have to deal with.

I think making these names configurable only adds boilerplate and maintenance overhead for no benefit:
- for the practice: the need to use a pass with a renamed tag/id should be extremely rare (do yo know any?)
- for the theory: a decorating pass could still rename before/after the processing, so this use case is still supported.

Side note: I skipped updating changelog+upgrade files. This would be just noise to me (nobody uses this possibility anyway ;) )

Commits
-------

6fe82d8be7 Deprecate configuring tag names and service ids in compiler passes
2021-03-16 10:12:04 +01:00
Nicolas Grekas
5850f3d4ea Merge branch '5.2' into 5.x
* 5.2:
  [ErrorHandler] Fix error caused by `include` + open_basedir
  [FrameworkBundle] Make the TestBrowserToken interchangeable with other tokens
  [Console] ProgressBar clears too many lines on update
  [FrameworkBundle] Exclude unreadable files when executing About command
  [Bridge\Twig] Add 'form-control-range' for range input type
  Be explicit about transparent background color of links in toolbar
  [Translation] fix test case name
  [Cache] Fix wrong namespace in test
  [DependencyInjection] Fix return type
2021-03-16 10:10:58 +01:00
Nicolas Grekas
ca06651235 Merge branch '4.4' into 5.2
* 4.4:
  [Console] ProgressBar clears too many lines on update
  [FrameworkBundle] Exclude unreadable files when executing About command
  [Bridge\Twig] Add 'form-control-range' for range input type
  Be explicit about transparent background color of links in toolbar
  [Translation] fix test case name
  [Cache] Fix wrong namespace in test
  [DependencyInjection] Fix return type
2021-03-16 10:10:13 +01:00
stlrnz
9ad7832acd [ErrorHandler] Fix error caused by include + open_basedir 2021-03-16 10:07:47 +01:00
Nicolas Grekas
faf7269806 bug #40368 [FrameworkBundle] Make the TestBrowserToken interchangeable with other tokens (Seldaek)
This PR was squashed before being merged into the 5.2 branch.

Discussion
----------

[FrameworkBundle] Make the TestBrowserToken interchangeable with other tokens

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

For some reason most tokens implement getFirewallName (and the deprecated getProviderKey), but not all. This adds it to TestBrowserToken because it caused issues in my tests when upgrading to Symfony 5's `Client::loginUser()`.

I am also happy to add this to AnonymousToken but I am more worried about BC impacts there, so I left it alone for now. All other token classes implement it, so I am not sure why this isn't in TokenInterface to begin with.

Commits
-------

a4958ae7ad [FrameworkBundle] Make the TestBrowserToken interchangeable with other tokens
2021-03-16 09:58:51 +01:00
Jordi Boggiano
a4958ae7ad [FrameworkBundle] Make the TestBrowserToken interchangeable with other tokens 2021-03-16 09:58:32 +01:00
Nicolas Grekas
a78fb1832b bug #40450 [Console] ProgressBar clears too many lines on update (danepowell)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Console] ProgressBar clears too many lines on update

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  |no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? |no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| License       | MIT

The ProgressBar incorrectly calculates line lengths when updating, including non-displayable characters such as ANSI colors. This causes it to clear too many lines if the terminal width is greater than the displayed line length but less than the line length including non-displayed characters. An example of this bug in action is https://github.com/acquia/cli/issues/467

Commits
-------

2aa3df0c74 [Console] ProgressBar clears too many lines on update
2021-03-16 09:54:45 +01:00
Dane Powell
2aa3df0c74 [Console] ProgressBar clears too many lines on update 2021-03-16 09:54:32 +01:00