Commit Graph

43748 Commits

Author SHA1 Message Date
Oskar Stark
0b13575df5 [Notifier] [FakeSms] Change DSN to be more realistic 2021-03-31 09:19:44 +02:00
Robin Chalas
3154509985 feature #40575 [FrameworkBundle][HttpKernel][TwigBridge] Add an helper to generate fragments URL (dunglas)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle][HttpKernel][TwigBridge] Add an helper to generate fragments URL

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix n/a
| License       | MIT
| Doc PR        | todo

This PR adds a new helper to generate raw fragment URL. Fragments will be useful to generate lazy frames with Symfony UX Turbo (https://github.com/symfony/ux/pull/64). This will also be convenient when using hinclude, ESI etc in case you want full control over the generated HTML.
This is also more in sync with the new best practices we apply in the form component (generate the HTML by yourself instead of using Twig helpers hiding the HTML elements).

Example:

```html
<turbo-frame id="set_aside_tray" src="{{ fragment_uri(controller('Symfony\Bundle\FrameworkBundle\Controller', {template: "foo.html.twig"})) }}">
  <img src="/icons/spinner.gif">
</turbo-frame>
```

Commits
-------

5d29d76612 [FrameworkBundle][HttpKernel][TwigBridge] Add an helper to generate fragments URL
2021-03-30 16:47:58 +02:00
Kévin Dunglas
5d29d76612 [FrameworkBundle][HttpKernel][TwigBridge] Add an helper to generate fragments URL 2021-03-30 16:47:49 +02:00
Robin Chalas
7327919e9e feature #38468 Messenger multiple failed transports (monteiro)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

Messenger multiple failed transports

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #34911
| License       | MIT
| Doc PR        | symfony/symfony-docs#13489
<!--
https://github.com/symfony/symfony-docs/pull/13489 Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch master.
-->

## Strategy applied

- Pass a map of transports and failed transports to the `SendFailedMessageToFailureTransportListener`. This way we re-use the same listener.
- Local failed transport has more priority than a global failed transport defined.

## Configuration example

```yaml
# config/packages/messenger.yaml
framework:
    # no need to set failed transport globally if I want a specific behaviour per transport.
    failure_transport: failed # all transports have this failed transport
    messenger:
        transports:
            failed: 'doctrine://default?queue_name=failed'
            failed_important: 'doctrine://default?queue_name=failed_important'
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                failure_transport: failed # takes precedence over the global defined "failed_transport"
                retry_strategy:
                    max_retries: 3
                    delay: 1000
                    multiplier: 2
            async_no_failure_transport: # it will use the global defined transport if no one is defined.
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                retry_strategy:
                    max_retries: 3
                    delay: 1000
                    multiplier: 2
            async_send_specific_failure_queue:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                failed_transport: failed_important # takes precedence over the global defined "failed_transport"
                retry_strategy:
                    max_retries: 3
                    delay: 1000
                    multiplier: 2
```

You can test this feature easily on a [demo project](https://github.com/monteiro/messenger-multiple-failed-transports-pr34979). Just follow the [README](https://github.com/monteiro/messenger-multiple-failed-transports-pr34979).

**More information on issue #34911**

## What needs to be done so this can be merged:
- [x] validate strategy
- [ ] update src/**/CHANGELOG.md files
- [x] update tests to cover all cases
- [x] create doc PR

Commits
-------

5810b6c378 Messenger multiple failed transports
2021-03-30 16:29:57 +02:00
Hugo Monteiro
5810b6c378 Messenger multiple failed transports 2021-03-30 16:28:46 +02:00
Oskar Stark
5572bab94d [Notifier] [FakeSms] Use correct namespace 2021-03-29 14:17:30 +02:00
Oskar Stark
c14d189ba5 feature #39949 [Notifier] [FakeSms] Add the bridge (JamesHemery)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Notifier] [FakeSms] Add the bridge

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      |no
| New feature?  | yes
| Deprecations? | no
| License       | MIT
| Doc PR        | symfony/symfony-docs#14870
| Recipe PR        | symfony/recipes#882

@OskarStark Bridge added :)

Commits
-------

351065e774 [Notifier] [FakeSms] Add the bridge
2021-03-29 14:05:03 +02:00
James Hemery
351065e774 [Notifier] [FakeSms] Add the bridge 2021-03-29 14:04:56 +02:00
Wouter de Jong
8afd7a3765 [Security] Rename UserInterface::getUsername() to getUserIdentifier() 2021-03-28 22:24:55 +02:00
Robin Chalas
c469ea6fff Merge branch '5.2' into 5.x
* 5.2:
  [Security] Use more concrete user classes in tests
  fix docblock
2021-03-28 19:35:24 +02:00
Wouter de Jong
631408b757 [Security] Use more concrete user classes in tests 2021-03-28 19:23:00 +02:00
Nyholm
5545755b58
minor #40611 [HttpKernel] fix docblock (xabbuh)
This PR was merged into the 5.2 branch.

Discussion
----------

[HttpKernel] fix docblock

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

Commits
-------

73999b8a3a fix docblock
2021-03-28 18:31:18 +02:00
Wouter de Jong
f30c103cb6 Merge branch '5.2' into 5.x
* 5.2:
  Use concrete user related classes in the tests
  [Filesystem] Fix dumpFile() method call
2021-03-28 16:57:18 +02:00
Wouter de Jong
b5f0f7bb82 Merge branch '4.4' into 5.2
* 4.4:
  [Filesystem] Fix dumpFile() method call
2021-03-28 16:30:26 +02:00
Wouter de Jong
89d9de2077 Use concrete user related classes in the tests
This allows the tests to automatically adapt for changes in the UserInterface
and UserProviderInterface in 5.x
2021-03-28 16:18:37 +02:00
Christian Flothmann
73999b8a3a fix docblock 2021-03-28 15:55:03 +02:00
sebpacz
2b33d4af65 [Filesystem] Fix dumpFile() method call 2021-03-28 11:59:32 +02:00
Christian Flothmann
9139f774af Merge branch '5.2' into 5.x
* 5.2:
  fix merge
2021-03-28 11:59:21 +02:00
Christian Flothmann
d33973bbbe fix merge 2021-03-28 11:59:03 +02:00
Christian Flothmann
42a56528e9 Merge branch '5.2' into 5.x
* 5.2:
  skip intl dependent tests if the extension is missing
  make DateCaster tests timezone-agnostic
  error if the input string couldn't be parsed as a date
  IntegerType: Always use en for IntegerToLocalizedStringTransformer Fixes #40456
  Uses the correct assignment action for console options depending if they are short or long
  [HttpKernel] ConfigDataCollector to return known data without the need of a Kernel
  [HttpClient] fix using stream_copy_to_stream() with responses cast to php streams
  FIx Trying to clone an uncloneable object of class
2021-03-28 11:44:11 +02:00
Christian Flothmann
6e1015fbca Merge branch '4.4' into 5.2
* 4.4:
  skip intl dependent tests if the extension is missing
  make DateCaster tests timezone-agnostic
  error if the input string couldn't be parsed as a date
  IntegerType: Always use en for IntegerToLocalizedStringTransformer Fixes #40456
  Uses the correct assignment action for console options depending if they are short or long
  [HttpKernel] ConfigDataCollector to return known data without the need of a Kernel
  [HttpClient] fix using stream_copy_to_stream() with responses cast to php streams
  FIx Trying to clone an uncloneable object of class
2021-03-28 11:42:18 +02:00
Christian Flothmann
71da904de0 skip intl dependent tests if the extension is missing 2021-03-28 10:05:52 +02:00
Fabien Potencier
84bbfb36c9 Fix CS 2021-03-28 08:39:13 +02:00
Fabien Potencier
8081d97994 minor #40585 [Serializer] Nicer ExtraAttributesException message for single attribute (finwe)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Serializer] Nicer ExtraAttributesException message for single attribute

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

This PR changes wording of ExtraAttributesException message in case there is only one extra attribute:

Before
----
    Extra attributes are not allowed ("foo", "bar" are unknown).
    Extra attributes are not allowed ("foo" are unknown).

After:
----

    Extra attributes are not allowed ("foo", "bar" are unknown).
    Extra attributes are not allowed ("foo" is unknown).

Commits
-------

1ba6a2cf50 [Serializer] Nicer ExtraAttributesException message for single attribute
2021-03-28 08:38:24 +02:00
Fabien Potencier
5666a45a02 bug #40598 [Form] error if the input string couldn't be parsed as a date (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Form] error if the input string couldn't be parsed as a date

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

When the Intl polyfill is used instead of the PHP intl extension, the
intl_get_error_code() function always returns 0 no matter if the input
string could be parsed.

Commits
-------

5ce5300da3 error if the input string couldn't be parsed as a date
2021-03-28 08:36:08 +02:00
Fabien Potencier
9889c492d7 bug #40587 [HttpClient] fix using stream_copy_to_stream() with responses cast to php streams (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix using stream_copy_to_stream() with responses cast to php streams

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

Commits
-------

cf1404a30b [HttpClient] fix using stream_copy_to_stream() with responses cast to php streams
2021-03-28 08:32:58 +02:00
Stefano Arlandini
1ef44ae7c6 [Cache] Support a custom serializer in the ApcuAdapter class 2021-03-28 08:28:53 +02:00
Nyholm
0d99f93eaf
minor #40599 [VarDumper] make DateCaster tests timezone-agnostic (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[VarDumper] make DateCaster tests timezone-agnostic

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

Commits
-------

bfef4546d3 make DateCaster tests timezone-agnostic
2021-03-27 22:10:44 +01:00
Christian Flothmann
bfef4546d3 make DateCaster tests timezone-agnostic 2021-03-27 20:49:03 +01:00
Christian Flothmann
5ce5300da3 error if the input string couldn't be parsed as a date
When the Intl polyfill is used instead of the PHP intl extension, the
intl_get_error_code() function always returns 0 no matter if the input
string could be parsed.
2021-03-27 18:05:23 +01:00
Fabien Potencier
b2e46a92a9 Fix typo 2021-03-27 16:08:04 +01:00
Fabien Potencier
912d3e58b4 feature #40449 [TwigBridge] add tailwindcss form layout (kbond)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[TwigBridge] add tailwindcss form layout

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

Per @weaverryan's [call to action on twitter](https://twitter.com/weaverryan/status/1369654724107067392) and slack discussion.

It's been tricky to create a generic form layout for tailwind as it's a css *utility framework* and has an unlimited number of ways to style forms. With tailwindcss 2.0, the tailwind team released an [official form plugin](https://github.com/tailwindlabs/tailwindcss-forms) that provides form element reset/normalization that looks decent out of the box. This PR is an attempt to piggy-back on this plugin to provide a minimal Symfony form layout for tailwind. The goal is to have your forms look good in a tailwind/Symfony app with no customization (but of course allow customization as desired).

This layout **requires** tailwindcss 2 and the form plugin.

I followed the ["unstyled" demo](https://tailwindcss-forms.vercel.app/) for the form plugin as a style guide. Here is a screenshot of this layout used in [a demo Symfony app](https://github.com/kbond/symfony-tailwind) with several common form types (I'll try to keep this updated as I update the PR):
![New-Post](https://user-images.githubusercontent.com/127811/112684961-3d2cc380-8e4a-11eb-8e43-0c08d2eecd7a.png)

Some notes about the layout:
1. I tried to use as few tailwind classes as possible and avoid color (primary exception being the error color).
2. I decided on a mobile-first approach so out of the box, it will look decent on any device and drastically reduces the number of css classes/assumptions.
3. While other layouts merge classes passed by the user, I opted to replace. This ensures the user doesn't have to _undo_ the class decisions made by this layout. I also discovered "undoing" doesn't work as I expected anyway: `class="mt-1 mt-0"`, `mt-1` "wins" as `mt-1` comes later in the compiled stylesheet.
4. For the _low level_ blocks, I extracted the classes into their own "variables" (`row_class`, `widget_class`, `label_class`, `help_class`, `error_item_class`) to make it easier to extend and customize the layout. Note the `widget_disabled_class`/`widget_errors_class` variables: these are added even if you've overridden the `widget_class` variable.

### Customization

Customizing is especially important for this layout. Here are the two ways:
1. Twig form functions:
    ```twig
    {{ form_row(form.title, {
        row_class: 'my row classes',
        label_class: 'my label classes',
        error_item_class: 'my error item classes',
        widget_class: 'my widget classes',
        widget_disabled_class: 'my disabled widget classes',
        widget_errors_class: 'my widget with error classes',
    }) }}
    ```
2. Project specific form layout:
    ```twig
    {% use 'tailwind_2_layout.html.twig' %}

    {%- block form_row -%}
        {%- set row_class = row_class|default('my row classes') -%}
        {{- parent() -}}
    {%- endblock form_row -%}

    {%- block widget_attributes -%}
        {%- set widget_class = widget_class|default('my widget classes') -%}
        {%- set widget_disabled_class = widget_disabled_class|default('my disabled widget classes') -%}
        {%- set widget_errors_class = widget_errors_class|default('my widget with error classes') -%}
        {{- parent() -}}
    {%- endblock widget_attributes -%}

    {%- block form_label -%}
        {%- set label_class = label_class|default('my label classes') -%}
        {{- parent() -}}
    {%- endblock form_label -%}

    {%- block form_help -%}
        {%- set help_class = help_class|default('my label classes') -%}
        {{- parent() -}}
    {%- endblock form_help -%}

    {%- block form_errors -%}
        {%- set error_item_class = error_item_class|default('my error item classes') -%}
        {{- parent() -}}
    {%- endblock form_errors -%}
    ```

#### Customization POC/Demo

With this custom form theme:
```twig
{%- block form_label -%}
    {%- set label_class = label_class|default('block text-gray-500 uppercase tracking-wider text-sm font-bold') -%}
    {{- parent() -}}
{%- endblock -%}

{%- block widget_attributes -%}
    {%- set widget_class = widget_class|default('mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50') -%}
    {{- parent() -}}
{%- endblock -%}

{%- block checkbox_widget -%}
    {%- set widget_class = widget_class|default('mr-2 rounded border-gray-300 text-indigo-600 shadow-sm focus:border-indigo-300 focus:ring focus:ring-offset-0 focus:ring-indigo-200 focus:ring-opacity-50') -%}
    {{- parent() -}}
{%- endblock -%}

{%- block checkbox_label -%}
    {%- set label_class = label_class|default('block text-gray-800') -%}
    {{- block('form_label') -}}
{%- endblock -%}
```

The above example looks like this:
![New-Post (3)](https://user-images.githubusercontent.com/127811/112705040-657ce800-8e73-11eb-965f-de289e9b978a.png)

Commits
-------

3719a409b6 [TwigBridge] add tailwindcss form layout
2021-03-27 16:07:06 +01:00
Kevin Bond
3719a409b6 [TwigBridge] add tailwindcss form layout 2021-03-27 16:06:57 +01:00
Christian Flothmann
d0875a9287 bug #40510 [Form] IntegerType: Always use en for IntegerToLocalizedStringTransformer (Warxcell)
This PR was merged into the 4.4 branch.

Discussion
----------

[Form] IntegerType: Always use en for IntegerToLocalizedStringTransformer

Fixes #40456

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

Commits
-------

83b836dbc9 IntegerType: Always use en for IntegerToLocalizedStringTransformer Fixes #40456
2021-03-26 15:31:20 +01:00
Warxcell
83b836dbc9 IntegerType: Always use en for IntegerToLocalizedStringTransformer
Fixes #40456
2021-03-26 12:41:55 +02:00
Roberto Nygaard
d0a3c538f4 Uses the correct assignment action for console options depending if they are short or long 2021-03-26 10:23:24 +01:00
Nyholm
a863e2fe8d
bug #40535 [HttpKernel] ConfigDataCollector to return known data without the need of a Kernel (topikito)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[HttpKernel] ConfigDataCollector to return known data without the need of a Kernel

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

Sets `$this->data` with information that can be known without the need of a `Kernel`.

Commits
-------

d919f2ce83 [HttpKernel] ConfigDataCollector to return known data without the need of a Kernel
2021-03-25 19:50:57 +01:00
Roberto Nygaard
d919f2ce83
[HttpKernel] ConfigDataCollector to return known data without the need of a Kernel 2021-03-25 19:50:37 +01:00
Nicolas Grekas
cf1404a30b [HttpClient] fix using stream_copy_to_stream() with responses cast to php streams 2021-03-25 18:52:07 +01:00
Matěj Humpál
1ba6a2cf50
[Serializer] Nicer ExtraAttributesException message for single attribute 2021-03-25 18:21:49 +01:00
Jan Rosier
0144d0a151 The $algorithms array is only used when $algorithm is set 2021-03-25 17:57:36 +01:00
Robin Chalas
2dcf313a87 feature #40567 [Security] Move the badges resolution check to AuthenticatorManager (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Security] Move the badges resolution check to `AuthenticatorManager`

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no (BC breaks on experimental code)
| Tickets       | Fixes #40491
| License       | MIT
| Doc PR        | -

Commits
-------

532f4aaa8e [Security] Move the badges resolution check to `AuthenticatorManager`
2021-03-24 15:58:59 +01:00
Robin Chalas
532f4aaa8e [Security] Move the badges resolution check to AuthenticatorManager 2021-03-24 13:36:59 +01:00
Nicolas Grekas
16f3fc1e55 minor #40568 Fix Trying to clone an uncloneable object of class (jderusse)
This PR was merged into the 4.4 branch.

Discussion
----------

Fix Trying to clone an uncloneable object of class

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

Since `ext-redis: 5.3..3`, the `\Redis` class is not cloneable anymore (https://github.com/phpredis/phpredis/commit/cd05a344).
PHPUnit 7.5 (used byt PHP 7.1) clones objects provided by the dataprovier, when they are cloneable.
To check if an object is cloneable, it use the `Reflexion::isCloneable` method and check if the `__clone` method is public.

The issue is, the Class generated by `createMock` is cloneable, which leads to an exception such as:
> Trying to clone an uncloneable object of class Mock_Redis_b2f171b3

This PR fake replaces the mock by a real instance of the class.

Commits
-------

f67dab95e2 FIx Trying to clone an uncloneable object of class
2021-03-24 09:42:51 +01:00
Jérémy Derussé
f67dab95e2
FIx Trying to clone an uncloneable object of class 2021-03-24 09:30:27 +01:00
Robin Chalas
4e85380d2f minor [Contracts] Fix branch name in README.md links 2021-03-24 00:28:01 +01:00
Nicolas Grekas
314ef9fb88 [Security/Http] conflict with symfony/security-bundle < 5.3 2021-03-23 22:56:56 +01:00
Nicolas Grekas
c9a8c6ff60 Fix tests 2021-03-23 22:40:36 +01:00
Benjamin Cremer
f4e50fb1c7 [HttpFoundation] Add support for mysql unix_socket and charset in PdoSessionHandler::buildDsnFromUrl 2021-03-23 22:32:01 +01:00
Nicolas Grekas
3bf6798031 feature #40153 [Security] LoginLink with specific locale (roromix)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Security] LoginLink with specific locale

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

I have added the possibility to create a login link for a specific locale. It's useful when we want generate a link for an other user who isn't in the same locale of us.

Commits
-------

50673c5321 [Security] LoginLink with specific locale
2021-03-23 22:14:39 +01:00