Commit Graph

54033 Commits

Author SHA1 Message Date
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
Nyholm
77870a5cec
minor #40608 [Filesystem] Fix dumpFile() method call (sebpacz)
This PR was merged into the 4.4 branch.

Discussion
----------

[Filesystem] Fix dumpFile() method call

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

The dumpFile() method in the Filesystem component takes two arguments (filename and content). I found a test with the third argument set to null.

Commits
-------

2b33d4af65 [Filesystem] Fix dumpFile() method call
2021-03-28 14:06:57 +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
1a2729199f minor #40606 [Form] skip intl dependent tests if the extension is missing (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Form] skip intl dependent tests if the extension is missing

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

Commits
-------

71da904de0 skip intl dependent tests if the extension is missing
2021-03-28 11:36:00 +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
Fabien Potencier
4193868415 feature #40602 [Cache] Support a custom serializer in the ApcuAdapter class (ste93cry)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Cache] Support a custom serializer in the ApcuAdapter class

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

Unlike some other cache adapters like the one for Redis, the APCu adapter does not support a custom serializer. Even though most things can be stored as-is in this cache, some others like resources cannot

Commits
-------

1ef44ae7c6 [Cache] Support a custom serializer in the ApcuAdapter class
2021-03-28 08:29:00 +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
Robin Chalas
ffc34fa33c bug #40593 Uses the correct assignment action for console options depending if they are short or long (topikito)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

Uses the correct assignment action for console options depending if they are short or long

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

Checks if the option is short or long, and assigns the corresponding "glue" for the assignment.

Commits
-------

d0a3c538f4 Uses the correct assignment action for console options depending if they are short or long
2021-03-26 10:23:36 +01: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
Robin Chalas
9abeb248a5 minor fix component path in codeowners 2021-03-26 09:24:59 +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
Robin Chalas
0d08a2127c minor #40584 [PasswordHasher] The $algorithms array is only used when $algorithm is set (rosier)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[PasswordHasher] The $algorithms array is only used when $algorithm is set

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

Small tweak

Commits
-------

0144d0a151 The $algorithms array is only used when $algorithm is set
2021-03-25 18:47:47 +01:00
Robin Chalas
d91e176335 add me as password-hasher code owner 2021-03-25 18:46:26 +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
Nicolas Grekas
620989dac1 feature #40300 [HttpFoundation] Add support for mysql unix_socket and charset in PdoSessionHandler::buildDsnFromUrl (bcremer, Nyholm)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[HttpFoundation] Add support for mysql unix_socket and charset in PdoSessionHandler::buildDsnFromUrl

| 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 https://github.com/symfony/symfony/issues/40290
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Commits
-------

f4e50fb1c7 [HttpFoundation] Add support for mysql unix_socket and charset in PdoSessionHandler::buildDsnFromUrl
2021-03-23 22:34:09 +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
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