Commit Graph

43748 Commits

Author SHA1 Message Date
Robin Chalas
d6791a6281 minor #40434 Don't use sprintf in trigger_deprecation() calls (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

Don't use sprintf in trigger_deprecation() calls

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

Old habits die hard :)

Commits
-------

9ba8f0567d Don't use sprintf in trigger_deprecation() calls
2021-03-10 12:42:38 +01:00
Robin Chalas
9ba8f0567d Don't use sprintf in trigger_deprecation() calls 2021-03-10 11:16:25 +01:00
Marco Pivetta
72a464e449 Fix ConstraintViolation#getMessageTemplate() to always return string
`ConstraintViolation#getMessageTemplate()`'s inherited signature states that `string` is
to be returned by it at all times, yet the implementation returns `null` when no message
template had been provided at instantiation.

This patch obviates it, returning an empty string when the
message template is `null`.

Ref: https://github.com/symfony/symfony/pull/40415#issuecomment-792839512
2021-03-10 10:59:31 +01:00
Nicolas Grekas
4449b553a8 [HttpKernel] Deprecate returning a ContainerBuilder from KernelInterface::registerContainerConfiguration() 2021-03-10 09:24:39 +01:00
Nicolas Grekas
a69bb1ef99 feature #40337 [DependencyInjection] Add support an integer return for default_index_method (maranqz)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[DependencyInjection] Add support an integer return for default_index_method

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

Commits
-------

f0922c70d6 [DependencyInjection] Add support an integer return for default_index_method
2021-03-10 08:45:30 +01:00
maranqz
f0922c70d6 [DependencyInjection] Add support an integer return for default_index_method 2021-03-10 08:45:06 +01:00
Fabien Potencier
e5f9a89a25 bug #40415 Fix ConstraintViolation#getPropertyPath() to always return string (Ocramius)
This PR was merged into the 5.2 branch.

Discussion
----------

Fix `ConstraintViolation#getPropertyPath()` to always return `string`

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

`ConstraintViolation#getPropertyPath()`'s inherited signature states that `string` is
to be returned by it at all times, yet the implementation returns `null` when no property
path had been provided at instantiation.

This patch obviates it, returning an empty string when the
property path is `null`.

Commits
-------

7d1029b907 Fix `ConstraintViolation#getPropertyPath()` to always return `string`
2021-03-10 08:37:25 +01:00
Nicolas Grekas
61b32ab2a3 [Runtime] a new component to decouple applications from global state 2021-03-09 21:44:54 +01:00
Jérémy Derussé
b3ee29244f
Fix eventListener initialization when eventSubscriber constructor dispatch an event 2021-03-09 17:20:30 +01:00
Fabien Potencier
eb1122c6dd bug #40313 [FrameworkBundle] Fix PropertyAccess definition when not in debug (PedroTroller)
This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Fix PropertyAccess definition when not in debug

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

The signature of the `PropertyAccessor::createCache()` method specifies that the first argument must be a string but in the `FameworkBundle` configures its DIC with a first argument to `null`. Replacing `null` by `''` allows to respect the contact of `PropertyAccessor::createCache()` and removes the following error when the `symfony/framework-bundle` is blocked in `4.4` but the symfony/property-access goes up to `5.2`.

```
Argument 3 passed to Symfony\Component\PropertyAccess\PropertyAccessor::createCache() must be of the type string, null given, called in /usr/src/app/var/cache/prod/ContainerDX7KWI4/getCache_PropertyAccessService.php on line 12
```

Commits
-------

116c54a554 Fix FrameworkBundle PropertyAccess definition when not in debug
2021-03-09 10:58:39 +01:00
Fabien Potencier
2fb98c8104 bug #40417 [Form] clear unchecked choice radio boxes even if clear missing is set to false (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Form] clear unchecked choice radio boxes even if clear missing is set to false

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

Commits
-------

e7b4851ea0 clear unchecked choice radio boxes even if clear missing is set to false
2021-03-09 10:34:10 +01:00
Alexander M. Turek
fc016ddd92 feature #39693 [PropertyAccess] use bitwise flags to configure when the property accessor should throw (xabbuh)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[PropertyAccess] use bitwise flags to configure when the property accessor should throw

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

Commits
-------

a50cfcb49d use bitwise flags to configure when the property accessor should throw
2021-03-09 10:10:37 +01:00
Nicolas Grekas
bedb98298b [FrameworkBundle] fix XSD 2021-03-09 09:47:49 +01:00
Nicolas Grekas
1f65e78280 minor #40317 [Cache] boost perf by wrapping keys validity checks with assert() (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Cache] boost perf by wrapping keys validity checks with `assert()`

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

PSR-6 has one perf hog: checking the validity of keys.

But in practice, an invalid key should never happen in production: encoding/cleanup is a must-have, and it's a step that should be identified *during dev*.

That's why I think we're safe wrapping these checks with `assert()`.

On an `ArrayAdapter`, this doubles the throughput of the pool when getting items.

I didn't use `assert()` in constructors when not on the hot path.

This PR also makes some callable properties static, as they should be from the beginning.

Commits
-------

8f03a1f555 [Cache] boost perf by wrapping keys validity checks with `assert()`
2021-03-09 09:28:49 +01:00
Christian Flothmann
a50cfcb49d use bitwise flags to configure when the property accessor should throw 2021-03-09 09:10:03 +01:00
Fabien Potencier
72c648907b bug #40388 [ErrorHandler] Added missing type annotations to FlattenException (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Added missing type annotations to FlattenException

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

This class has no constructor where the properties' types could be inferred from. If we want potential contributors (and our serializer, see #40385) to read that code, I think it's only fair that we document the property types via doc blocks.

Commits
-------

d68832e1b9 [ErrorHandler] Added missing type annotations to FlattenException
2021-03-09 07:21:27 +01:00
Benjamin Franzke
daaa760fd2 Avoid unneeded preg_replace_callback in console application
Motivations for this change:
 * Avoid an unneded preg call, explode+implode is faster
 * The previous regex created to suboptimal expressions,
   due to the pipe that caused empty to be matched.

   That means an input like `foo:bar`
   was translated into `foo[^:]*[^:]*:bar[^:]*[^:]*`
   instead of simply `foo[^:]*:bar[^:]*`
2021-03-08 22:52:55 +01:00
Christian Flothmann
e7b4851ea0 clear unchecked choice radio boxes even if clear missing is set to false 2021-03-08 18:14:47 +01:00
Marco Pivetta
7d1029b907 Fix ConstraintViolation#getPropertyPath() to always return string
`ConstraintViolation#getPropertyPath()`'s inherited signature states that `string` is
to be returned by it at all times, yet the implementation returns `null` when no property
path had been provided at instantiation.

This patch obviates it, returning an empty string when the
property path is `null`.
2021-03-08 14:20:18 +01:00
Alexander M. Turek
d68832e1b9 [ErrorHandler] Added missing type annotations to FlattenException 2021-03-08 11:28:40 +01:00
Alexander M. Turek
61b0be9564 [TwigBridge] Allow version 3 of the Twig extra packages 2021-03-07 20:47:33 +01:00
Alexander M. Turek
10d869d835 Merge branch '5.2' into 5.x
* 5.2:
  Allow egulias/email-validator 3.x
2021-03-07 17:16:20 +01:00
Alexander M. Turek
ce8be3c079 Merge branch '4.4' into 5.2
* 4.4:
  Allow egulias/email-validator 3.x
2021-03-07 17:08:20 +01:00
Fabien Potencier
d8cfa3e9a4 bug #39685 [Mailer][Mime][TwigBridge][Validator] Allow egulias/email-validator 3.x (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer][Mime][TwigBridge][Validator] Allow egulias/email-validator 3.x

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

Commits
-------

3beeadb0c3 Allow egulias/email-validator 3.x
2021-03-07 16:59:23 +01:00
Alexander M. Turek
0f92ad4fa8 Merge branch '5.2' into 5.x
* 5.2:
  [WebLink] Removed unused property
  Fix method name compare in ResolveControllerNameSubscriber
  add uz security validator and form validator file
  uzb translation
2021-03-07 16:51:58 +01:00
Alexander M. Turek
4667c85098 Merge branch '4.4' into 5.2
* 4.4:
  [WebLink] Removed unused property
  Fix method name compare in ResolveControllerNameSubscriber
  add uz security validator and form validator file
  uzb translation
2021-03-07 16:51:33 +01:00
Alexander M. Turek
3beeadb0c3 Allow egulias/email-validator 3.x 2021-03-07 16:14:50 +01:00
Robin Chalas
b04a7c1be3 minor #40402 [WebLink] Removed unused property (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[WebLink] Removed unused property

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

In `Link::withHref()`, a property `templated` is written, that is never declared or access anywhere else. I assume that this is dead code.

Commits
-------

848972e830 [WebLink] Removed unused property
2021-03-07 15:28:05 +01:00
Alexander M. Turek
28fb06e0af bug #40398 [FrameworkBundle] [4.4]: Fix method name compare in ResolveControllerNameSubscriber (glensc)
This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] [4.4]: Fix method name compare in ResolveControllerNameSubscriber

| 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 -->
| Tickets       | <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | <!-- required for new features -->

The left side to `strtolower` was not actually lowercased, so it would be always `false`.

The bug was introduced in 6c109c71a9 (https://github.com/symfony/symfony/pull/31938)

<!--
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/releases):
 - 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 5.x.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
-->

Commits
-------

69431a3db3 Fix method name compare in ResolveControllerNameSubscriber
2021-03-07 14:25:48 +01:00
Alexander M. Turek
848972e830 [WebLink] Removed unused property 2021-03-07 14:19:33 +01:00
Wouter de Jong
e731f5fda9 [Validator] Add createValidCallable() that returns a boolean 2021-03-07 13:57:34 +01:00
Elan Ruusamäe
69431a3db3
Fix method name compare in ResolveControllerNameSubscriber
The left side to strtolower was not actually lowercased, so it would be always false.
2021-03-07 01:28:11 +02:00
shokhaa
73392924bf add uz security validator and form validator file 2021-03-07 00:00:06 +05:00
shokhaa
df4679c163 uzb translation 2021-03-06 19:17:14 +01:00
Robin Chalas
f052d11a43 Merge branch '5.2' into 5.x
* 5.2:
  [Security] Fix test
  fix test
  [Console] Fix tests
2021-03-06 14:50:37 +01:00
Robin Chalas
7bc31c64f2 [Security] Fix test 2021-03-06 14:47:01 +01:00
Robin Chalas
04cb83e1f9 fix test 2021-03-06 14:42:15 +01:00
Robin Chalas
706f05a8db Merge branch '4.4' into 5.2
* 4.4:
  [Console] Fix tests
2021-03-06 14:35:24 +01:00
Robin Chalas
415e019d77 [Console] Fix tests 2021-03-06 14:09:26 +01:00
Fabien Potencier
8de664d4f3 feature #40267 [Security] Decouple passwords from UserInterface (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Security] Decouple passwords from UserInterface

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | yes
| Tickets       | #23081, helps with #39308
| License       | MIT
| Doc PR        | todo

This PR addresses a long-standing issue of the Security component: UserInterface is coupled to passwords.
It does it by moving the `getPassword()` method from `UserInterface` to a `PasswordAuthenticatedUserInterface`, and the `getSalt()` method to a `LegacyPasswordAuthenticatedUserInterface`.

Steps:
- In 5.3, we add the new interface and, at places where password-based authentication happens, trigger deprecation notices when a `UserInterface` object does not implement the new interface(s). The UserInterface is kept as-is until 6.0.
- In 6.0, we can remove the methods from `UserInterface` as well as support for using password authentication with user objects not implementing the new interface(s).

As a side-effect, some password-related interfaces (`UserPasswordHasherInterface` and `PasswordUpgraderInterface`) must change their signatures to type-hint against the new interface.
That is done in a BC way, which is to make the concerned methods virtual until 6.0, with deprecation notices triggered from callers and concrete implementations.

Benefits:
In 6.0, applications that use password-less authentication (e.g. login links) won't need to write no-op `getPassword()` and `getSalt()` in order to fulfil the `UserInterface` contract.

For applications that do use password-based authentication, they will need to opt-in explicitly by implementing the relevant interface(s).

This build on great discussions with @wouterj and @nicolas-grekas, and it is part of the overall rework of the Security component.

Commits
-------

2764225a38 [Security] Decouple passwords from UserInterface
2021-03-06 11:59:38 +01:00
Fabien Potencier
d752c1ecb5 feature #40377 [Notifier] [OvhCloud] Add "sender" (notFloran)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Notifier] [OvhCloud] Add "sender"

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features --> (I'm waiting to see if the feature is accepted )

Add "sender" option to the DSN that allows configuring the sender of the message.

OVHCloud manages two cases for sending sms according to the [doc](https://docs.ovh.com/fr/sms/envoyer_des_sms_avec_lapi_ovh_en_php/):

> The senderForResponse parameter will allow the use of a short number, which allows you to send SMS directly without having to create an alphanumeric sender (for example: your name).
> Short numbers also allow you to receive responses from the recipients of your SMS, which can be useful for a satisfaction survey, a voting application, a game, etc.

![CleanShot 2021-03-05 at 13 26 33](https://user-images.githubusercontent.com/523981/110115554-84c5af80-7db6-11eb-815d-7e8bafa81e5d.png)

This PR introduces the management of these 2 cases with a new option `sender`:
* if `sender` is set, we use it
* if `sender` is not set, we use `senderForResponse` to get a short number (current behavior)

I took the logic implementedin the old official SDK : 52d279e112/src/Message.php (L161)

Commits
-------

c5a9b252ab [Notifier] [OvhCloud] Add "sender"
2021-03-06 09:31:28 +01:00
Floran Brutel
c5a9b252ab [Notifier] [OvhCloud] Add "sender" 2021-03-06 09:31:27 +01:00
Fabien Potencier
25e8d7dafb feature #40384 [DependencyInjection] Implement psr/container 1.1 (derrabus)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[DependencyInjection] Implement psr/container 1.1

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

The `psr/container` interfaces have been updated with type declarations. The lack of those is what kept us from adding property type declarations to the `get()` and `has()` methods of our own `ContainerInterface`.

A small BC break is that we have never prevented calling code from passing `null` as the service ID. Even without strict types, this will cause a `TypeError` after my changes. I already had to update `AutowirePass` because of that.

On the other hand, it was neither documented that we allow `null` here nor did the container do anything useful (`has(null)` always resulted in `false` and `get(null)` always returned `null`).

Commits
-------

d9095aa892 [DependencyInjection] Implement psr/container 1.1
2021-03-06 09:21:02 +01:00
Fabien Potencier
94b8e32c4c Fix typo 2021-03-06 09:14:32 +01:00
Fabien Potencier
f467708b06 Merge branch '5.2' into 5.x
* 5.2:
  Fix typo
2021-03-06 09:11:22 +01:00
Fabien Potencier
436f697d81 Fix typo 2021-03-06 09:10:55 +01:00
Fabien Potencier
e53bb8b4f2 Merge branch '5.2' into 5.x
* 5.2:
  Fix #36973: Command description consistency
  Render email once
2021-03-06 09:05:19 +01:00
Fabien Potencier
7ed3d36f53 Merge branch '4.4' into 5.2
* 4.4:
  Fix #36973: Command description consistency
  Render email once
2021-03-06 08:59:01 +01:00
Fabien Potencier
57fb475ebf minor #40387 Fix #36973: Command description consistency (danepowell)
This PR was merged into the 4.4 branch.

Discussion
----------

Fix #36973: Command description consistency

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #36973
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/15062

This rewords command descriptions and options to use consistent verb mood.

Commits
-------

01e18b039a Fix #36973: Command description consistency
2021-03-06 08:54:06 +01:00
Robin Chalas
2764225a38 [Security] Decouple passwords from UserInterface 2021-03-06 00:37:05 +01:00
Alexander M. Turek
d9095aa892 [DependencyInjection] Implement psr/container 1.1 2021-03-05 23:51:52 +01:00
Alexander M. Turek
13055b6d66 bug #39733 [TwigBridge] Render email once (jderusse)
This PR was merged into the 4.4 branch.

Discussion
----------

[TwigBridge] Render email once

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

When `\Symfony\Component\Mailer\Mailer` send an email via the Bus (async) it dispatches an `MessageEvent`, then the consumer call the `\Symfony\Component\Mailer\Transport\AbstractTransport::send` method which also dispatches an `MessageEvent`.

This event is listened by `\Symfony\Bridge\Twig\Mime\BodyRenderer::render` which rendered twice an email.

I'm not sure why the event is send twice, and if we could safely remove one of them (or maybe deprecating the `MessageEvent`, in favor of `SendMessageEvent` + `AsyncMessageEvent`)

This PR store a flag in the Message to avoid rendering it twice.

Commits
-------

186ea59180 Render email once
2021-03-05 22:53:44 +01:00
Alexander M. Turek
57953845ad Merge branch '5.2' into 5.x
* 5.2:
  Backport psr/container 1.1/2.0 compatibility
  Update notifier_transports.php
  Dont lock tables or start transactions
  Bump Symfony version to 5.2.5
  Update VERSION for 5.2.4
  Update CHANGELOG for 5.2.4
  Bump Symfony version to 4.4.21
  Update VERSION for 4.4.20
  Update CONTRIBUTORS for 4.4.20
  Update CHANGELOG for 4.4.20
2021-03-05 21:15:37 +01:00
Alexander M. Turek
59731896ed Merge branch '4.4' into 5.2
* 4.4:
  Backport psr/container 1.1/2.0 compatibility
  Bump Symfony version to 4.4.21
  Update VERSION for 4.4.20
  Update CONTRIBUTORS for 4.4.20
  Update CHANGELOG for 4.4.20
2021-03-05 21:13:41 +01:00
Alexander M. Turek
7f8242ef58 Backport psr/container 1.1/2.0 compatibility 2021-03-05 19:16:26 +01:00
Dane Powell
01e18b039a
Fix #36973: Command description consistency 2021-03-05 09:58:50 -08:00
Fabien Potencier
9978ba805f bug #40376 [Messenger] Don't lock tables or start transactions (Nyholm)
This PR was merged into the 5.2 branch.

Discussion
----------

[Messenger] Don't lock tables or start transactions

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

I was so sure my PR #40336 fixed the doctrine-messenger issue once and for all. But it had a very silent bug..

This has been tricky to debug and find because the `PDO` behaves differently in PHP 7.4 compared to PHP 8.

| Scenario | Command | Is executed in transaction | Method that calls `PostgreSqlConnection::getTriggerSql()` |
| --| -- | -- | -- |
| A | `messenger:setup-transports` | No | `setup()`
| B| `doctrine:schema:create` | No | `getExtraSetupSqlForTable()`
| C | `doctrine:migration:diff` | Yes by default, but it can be configured | `getExtraSetupSqlForTable()`

PR #40055 fixed scenario C on PHP 8, but that also broke scenario B on PHP 7.4 and PHP 8.
In PR #40336 I was wrong claiming:

> We don't need COMMIT because the transaction will commit itself when we close the connection.

The result was the we removed all the errors messages from the 3 scenarios. But scenario B will produce some SQL that is actually never committed. IE it will silently fail.

I've been trying to figure out a good solution to how or when to start a transaction. I tried out @fbourigault [suggestion](https://github.com/symfony/symfony/pull/40336#issuecomment-790622951) but that would be the same fix as #40055.

---------------

We need a transaction because the SQL includes a `LOCK TABLE`, however, I cannot see a strict need for it. This PR removes `LOCK TABLE` and all transaction juggling. It all seams to work.

I would be happy to get thorough feedback on this PR so we can end the chapter of constantly adding bugs to this part of the component.

@dunglas, you added `LOCK TABLE` in your initial version of this class in https://github.com/symfony/symfony/pull/35485, could you share some knowledge if this is a good or bad idea?

Commits
-------

26061a131d Dont lock tables or start transactions
2021-03-05 18:19:32 +01:00
Ronny
61c5bafafc
Update notifier_transports.php 2021-03-05 13:38:28 +01:00
Fabien Potencier
f8e2cff9ba feature #40229 [FrameworkBundle][Translation] Extract translation IDs from all of src (natewiebe13)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle][Translation] Extract translation IDs from all of src

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Related to #39126 possibly #35082 as well
| License       | MIT
| Doc PR        | TBD

This PR allows extracting (`bin/console translation:update`) and debugging (`bin/console debug:translation`) translations using Translatable messages.

Currently we only check classes that include the `TranslatorInterface`, but this no longer covers all instances of this.

Current considerations:
- Should this be treated as a bug fix or a new feature? On one hand, text extraction would no longer work if moving to TranslatableMessages (like we're doing) on the other, it wasn't intended to search all PHP files. As a bug fix would get this into Symfony faster, as a feature would mean having to wait until 5.3 is released.
- Is there a better way to get the source directory that doesn't involve hardcoding `/src`?
- Adding this in on a project with ~12k LOC in `/src` takes these operations from about 3s to 5s, but I feel like this is reasonable considering this command isn't likely called constantly. I can provide more accurate stats as requested.

Commits
-------

b02ae5050c [FrameworkBundle][Translation] Extract translation IDs from all of src
2021-03-05 13:17:54 +01:00
Nate Wiebe
b02ae5050c [FrameworkBundle][Translation] Extract translation IDs from all of src 2021-03-05 13:17:50 +01:00
Nyholm
26061a131d
Dont lock tables or start transactions 2021-03-05 13:14:19 +01:00
fritzmg
0f9434c189 check if templating engine supports view 2021-03-05 11:13:54 +00:00
Robin Chalas
c656ef9cf9 minor #40367 [Security] Re-add accidentally removed property declarations (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Security] Re-add accidentally removed property declarations

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

spotted while playing with psalm locally,  mistake made in #39802

Commits
-------

bccf736b99 [Security] Readd accidentally removed property declarations
2021-03-05 11:14:22 +01:00
Robin Chalas
bccf736b99 [Security] Readd accidentally removed property declarations 2021-03-05 10:30:44 +01:00
Fabien Potencier
f72d5165fd Bump Symfony version to 5.2.5 2021-03-04 19:11:30 +01:00
Fabien Potencier
ff8cb872d3 Update VERSION for 5.2.4 2021-03-04 19:05:55 +01:00
Fabien Potencier
2536e178b1 Bump Symfony version to 4.4.21 2021-03-04 19:04:32 +01:00
Fabien Potencier
369dea8c72 Update VERSION for 4.4.20 2021-03-04 19:00:27 +01:00
Fabien Potencier
4c6a3f9dd2 Merge branch '5.2' into 5.x
* 5.2:
  [Messenger] Doctrine setup with migrations
2021-03-04 18:39:06 +01:00
Fabien Potencier
0940043bfc bug #40336 [Messenger] Doctrine setup with migrations (Nyholm)
This PR was squashed before being merged into the 5.2 branch.

Discussion
----------

[Messenger] Doctrine setup with migrations

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

This PR reverts parts of #40055.

When running these commands, You do need to be in a transaction:
- `doctrine:schema:create`
- `messenger:setup-transports`
- `doctrine:migrations:diff` and `doctrine:migrations:migrate`

Commits
-------

3371e1cf39 [Messenger] Doctrine setup with migrations
2021-03-04 18:38:30 +01:00
Nyholm
3371e1cf39 [Messenger] Doctrine setup with migrations 2021-03-04 18:38:24 +01:00
Fabien Potencier
33791925af Merge branch '5.2' into 5.x
* 5.2:
  [Validator] Fix return types
  Add translation for Belarusian
  fix parsing calls of methods named "method"
  [Security] Remove unnecessary inherited doc annotation
  deal with indented heredoc/nowdoc tokens
  Adding templates for Belarusian
2021-03-04 16:41:30 +01:00
Fabien Potencier
5fea563f4a Merge branch '4.4' into 5.2
* 4.4:
  [Validator] Fix return types
  Add translation for Belarusian
  fix parsing calls of methods named "method"
  deal with indented heredoc/nowdoc tokens
  Adding templates for Belarusian
2021-03-04 16:41:09 +01:00
Fabien Potencier
218bf5ea9a bug #40318 [Translation] deal with indented heredoc/nowdoc tokens (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Translation] deal with indented heredoc/nowdoc tokens

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

Commits
-------

4721097cab deal with indented heredoc/nowdoc tokens
2021-03-04 16:39:09 +01:00
Alexander M. Turek
e67ef5bbff [Validator] Fix return types 2021-03-03 23:57:07 +01:00
marbul
9bddbbd7ed #40302 improve exception message when required argument is added after an optional one 2021-03-03 18:38:02 +01:00
Alexander M. Turek
ea741e6165 minor #40297 Add missing translations for Belarusian (Nyholm, OxanaKozlova)
This PR was merged into the 4.4 branch.

Discussion
----------

Add missing translations for Belarusian

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #38727 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | N/A <!-- required for new features -->

Add translations for Belarusian

Commits
-------

1b84d5d23b Add translation for Belarusian
8e1d3285ed Adding templates for Belarusian
2021-03-03 18:05:48 +01:00
OxanaKozlova
1b84d5d23b Add translation for Belarusian 2021-03-03 19:55:00 +03:00
Robin Chalas
fdabaf20cc feature #40338 [FrameworkBundle] Add support for doctrine/annotations:1.13 || 2.0 (Nyholm)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] Add support for doctrine/annotations:1.13 || 2.0

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

This PR will deprecate passing any other values that "none", "php_array" and "file" to `framework.annotation.cache`. It will also support `doctrine/annotations:^1.13 || ^2.0`. It will use the PSR-6 cache if possible.

Commits
-------

91e844b517 [FrameworkBundle] Add support for doctrine/annotations:1.13 || 2.0
2021-03-03 15:31:03 +01:00
Nyholm
91e844b517 [FrameworkBundle] Add support for doctrine/annotations:1.13 || 2.0 2021-03-03 15:30:50 +01:00
Christian Flothmann
a9de390676 fix parsing calls of methods named "method" 2021-03-03 13:11:09 +01:00
Junaid Farooq
4b70db1e85 [Security] Remove unnecessary inherited doc annotation 2021-03-02 19:18:23 +01:00
Alexander M. Turek
3a92844519 feature #40323 [TwigBridge][TwigBundle] Twig serialize filter (jrushlow)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[TwigBridge][TwigBundle] Twig serialize filter

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #40227
| License       | MIT
| Doc PR        | symfony/symfony-docs#15039

Adds a new `serialize` filter for Twig utilizing the Serializer component. As suggested in #40227 - would allow you to pass a serialized object to the front end without needing to make an ajax call.

Commits
-------

abb534ab56 implement twig serialize filter
2021-03-02 19:10:17 +01:00
Fabien Potencier
0f279b54fe feature #40339 [RateLimiter][Security] Add a login_throttling.interval (in security.firewalls) option to change the default throttling interval. (damienfa, wouterj)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[RateLimiter][Security] Add a `login_throttling.interval` (in `security.firewalls`) option to change the default throttling interval.

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

The only way to customize the default rate-limiter's options of the login_throttling (means fixed_window / 1 minute / 5 tokens) are through a custom limiter, which implies to declare a rate-limiter factory in the "framework.rate_limiter", a service which use this factory etc. It's really heavy just for changing an interval (moreover, 1 minute can be discutable).

In this PullRequest, I just propose to allow an `interval` option.

Example :
```yaml
security:
  firewalls:
    main:
       login_throttling:
           max_attempts: 5
           interval: '15 minutes'
```

See functional tests.

🤷🏻‍♂️  This pull-request is a copy of [this pull-request ](https://github.com/symfony/symfony/pull/39927) that I've created some weeks ago. On the original PR, I just needed to rebase on 5.x to pass the tests (fabbot etc.) but the rebase I've tried runs in a loop of conflicts and I'm stuck. I've never experienced this before... SORRY.

Commits
-------

d1a0342e1e Fix tests
cc7409502a changes rebased
2021-03-02 18:37:19 +01:00
Wouter de Jong
d1a0342e1e Fix tests 2021-03-02 14:27:07 +01:00
Alexander M. Turek
a8a0650161 Merge branch '5.2' into 5.x
* 5.2:
  [Messenger][SQS] Document missing option
  Specify that we run CI on Ubuntu-20.04
  zero parts can be omitted in date interval input
2021-03-02 13:23:03 +01:00
Alexander M. Turek
5985199754 Merge branch '4.4' into 5.2
* 4.4:
  Specify that we run CI on Ubuntu-20.04
  zero parts can be omitted in date interval input
2021-03-02 13:14:02 +01:00
Nyholm
bd6930effe
[Messenger][SQS] Document missing option 2021-03-02 12:28:15 +01:00
Jesse Rushlow
abb534ab56
implement twig serialize filter 2021-03-02 01:27:30 -05:00
Damien Fa
cc7409502a changes rebased 2021-03-02 00:08:58 +01:00
Robin Chalas
252f85c2c2 minor #40335 [FrameworkBundle] Disable lock to fix FrameworkBundle standalone tests in deps=high (wouterj)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] Disable lock to fix FrameworkBundle standalone tests in deps=high

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

Commits
-------

b169ef9259 [FrameworkBundle] Explicitly disable lock to fix FrameworkBundle standalone tests
2021-03-01 15:08:39 +01:00
Christian Flothmann
07d7f6bad7 bug #40316 [Serializer] zero parts can be omitted in date interval input (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Serializer] zero parts can be omitted in date interval input

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

Commits
-------

c316708669 zero parts can be omitted in date interval input
2021-03-01 14:37:03 +01:00
Alexander M. Turek
f49ca6f9cc Merge branch '5.2' into 5.x
* 5.2:
  improve exception message if symfony/security-csrf is missing
  fix: MockResponse total_time should not be simulated when provided
2021-03-01 01:41:04 +01:00
Alexander M. Turek
82e3b17cf4 Merge branch '4.4' into 5.2
* 4.4:
  improve exception message if symfony/security-csrf is missing
  fix: MockResponse total_time should not be simulated when provided
2021-03-01 01:40:14 +01:00
Wouter de Jong
b169ef9259 [FrameworkBundle] Explicitly disable lock to fix FrameworkBundle standalone tests 2021-02-27 20:48:21 +01:00
Albert Casademont
381a0a19f7 use InputBag for POST requests too, added missing scalar type hints 2021-02-26 23:11:14 +01:00
Alexander M. Turek
f0e076a013 feature #40307 [HttpKernel] Handle multi-attribute controller arguments (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[HttpKernel] Handle multi-attribute controller arguments

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

Currently, the `ArgumentMetadata` class used for controller argument value resolution can only hold one attribute per controller argument, while a method argument can take multiple attributes.

This allows accessing all attributes for a given argument, and deprecates the `ArgumentInterface` because it is not needed.
Spotted by @nicolas-grekas.

Commits
-------

d771e449ec [HttpKernel] Handle multi-attribute controller arguments
2021-02-26 19:19:30 +01:00
Christian Flothmann
4721097cab deal with indented heredoc/nowdoc tokens 2021-02-26 14:53:48 +01:00
Nicolas Grekas
4a9c8297ea fix tests 2021-02-26 14:19:17 +01:00
Nicolas Grekas
8f03a1f555 [Cache] boost perf by wrapping keys validity checks with assert() 2021-02-26 13:15:59 +01:00
Christian Flothmann
c316708669 zero parts can be omitted in date interval input 2021-02-26 13:02:03 +01:00
Christian Flothmann
1a26ed43e7 improve exception message if symfony/security-csrf is missing 2021-02-26 11:19:16 +01:00
Nicolas Grekas
a5683c5324 bug #40239 MockResponse total_time should not be simulated when provided (Pierrick VIGNAND)
This PR was merged into the 4.4 branch.

Discussion
----------

MockResponse total_time should not be simulated when provided

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

When you provide a `total_time` to a MockResponse, it is overriden. It should be simulated only when it is not provided I guess.
Ex: `new MockResponse('{"foo":"bar"}', ['total_time' => 0.4])`

Commits
-------

8dada95cbf fix: MockResponse total_time should not be simulated when provided
2021-02-26 11:01:20 +01:00
Pierre PLAZANET
116c54a554 Fix FrameworkBundle PropertyAccess definition when not in debug 2021-02-26 10:07:24 +01:00
Fabien Potencier
79f6a5c692 feature #40284 [RateLimiter][Security] Allow to use no lock in the rate limiter/login throttling (wouterj)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[RateLimiter][Security] Allow to use no lock in the rate limiter/login throttling

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

This PR adds support for disabling lock in rate limiters. This was brought up by @Seldaek. In most cases (e.g. login throttling), it's not critical to strictly avoid even a single overflow of the window/token. At least, it's probably not always worth the extra load on the lock storage (e.g. redis).

It also directly disables locking by default for login throttling. I'm not sure about this, but I feel like this fits the 80% case where it's definitely not needed (and it's easier to use if you don't need to set-up locking first).

Commits
-------

45be875e84 [Security][RateLimiter] Allow to use no lock in the rate limiter/login throttling
2021-02-26 08:27:17 +01:00
Robin Chalas
d771e449ec [HttpKernel] Handle multi-attribute controller arguments 2021-02-26 01:25:47 +01:00
Nicolas Grekas
59fbe57ed1 feature #39607 [Messenger] Add rediss:// DSN scheme support for TLS to Redis transport (njutn95)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Messenger] Add `rediss://` DSN scheme support for TLS to Redis transport

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

This adds a support for `rediss://` DSN (as discussed in https://github.com/symfony/symfony/pull/39599) and deprecates the use of `tls` parameter introduced in https://github.com/symfony/symfony/pull/35503 so it can be standardized to single format.

Commits
-------

28e7b74b47 [Messenger] Add `rediss://` DSN scheme support for TLS to Redis transport
2021-02-26 01:02:05 +01:00
viktor
28e7b74b47 [Messenger] Add rediss:// DSN scheme support for TLS to Redis transport 2021-02-26 01:01:54 +01:00
Nicolas Grekas
008f28026c Merge branch '5.2' into 5.x
* 5.2:
  [Cache] Add server-commands support for Predis Replication Environments
  Speedup psalm
2021-02-26 00:55:26 +01:00
Nicolas Grekas
2068652fc9 Merge branch '4.4' into 5.2
* 4.4:
  [Cache] Add server-commands support for Predis Replication Environments
  Speedup psalm
2021-02-26 00:54:56 +01:00
Nicolas Grekas
3fe1564912 bug #40299 [Cache] Add server-commands support for Predis Replication Environments (DemigodCode)
This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] Add server-commands support for Predis Replication Environments

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

This fix is for predis MasterSlaveConnections which don't allow to run server commands.
Due to that it's not possible to e.g. clear a cache with cache:pool:clear.

PhpRedis and Predis do not have the same interface, so have to check which implementation is used.
Furthermore, the getClientFor('master') works only for replicated redis instances.

Commits
-------

2ae5c33c80 [Cache] Add server-commands support for Predis Replication Environments
2021-02-26 00:52:22 +01:00
DemigodCode
2ae5c33c80 [Cache] Add server-commands support for Predis Replication Environments 2021-02-26 00:52:11 +01:00
Robin Chalas
64b76968bf minor #40309 Fix deprecation messages (rosier)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

Fix deprecation messages

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

The wrong namespace is used in the deprecation messages

Commits
-------

4aca3edb9e Fix deprecation messages
2021-02-25 19:35:29 +01:00
Jan Rosier
4aca3edb9e Fix deprecation messages 2021-02-25 19:35:00 +01:00
Pierrick VIGNAND
8dada95cbf
fix: MockResponse total_time should not be simulated when provided 2021-02-25 19:06:45 +01:00
Nicolas Grekas
d9dedb45bd feature #40306 [HttpClient] Add HttpClientInterface::withOptions() (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[HttpClient] Add `HttpClientInterface::withOptions()`

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

I've been thinking about this method for a few months already.
We miss a way to configure an HTTP client in a generic way.
This is useful when eg building an API client as this allows configuring default options once for a consumer, eg in the constructor.

```php
$this->client = $client->withOptions(['base_uri' => 'https://...']);

// [...]

$response = $this->client->request('GET', '/relative-url');
```

Commits
-------

439742ff33 [HttpClient] Add `HttpClientInterface::withOptions()`
2021-02-25 18:53:57 +01:00
Nicolas Grekas
60ce52f503 Merge branch '5.2' into 5.x
* 5.2:
  fix merge
2021-02-25 18:37:08 +01:00
Nicolas Grekas
5854d55aef fix merge 2021-02-25 18:36:22 +01:00
Nicolas Grekas
cd59bfa080 Merge branch '5.2' into 5.x
* 5.2:
  [HttpKernel] Configure `session.cookie_secure` earlier
  Make sure the Psalm review CI job is working
  Adding a Github action to run Psalm
2021-02-25 18:20:06 +01:00
Nicolas Grekas
d978bea326 Merge branch '4.4' into 5.2
* 4.4:
  [HttpKernel] Configure `session.cookie_secure` earlier
  Make sure the Psalm review CI job is working
  Adding a Github action to run Psalm
2021-02-25 18:16:57 +01:00
Nicolas Grekas
87aeb8da13 bug #40231 [HttpKernel] Configure session.cookie_secure earlier (tamcy)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Configure `session.cookie_secure` earlier

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

This PR does what @stof had suggested in #40221, allow me to quote him directly:

> 1. avoid setting auto as a value for the ini setting in the NativeSessionStorage initialization
> 2. ensuring that SessionListener resolves the auto value by the time the SessionListener runs, and not by the time the getSession() method is called in the Request session factory callback

Commits
-------

e82918cd60 [HttpKernel] Configure `session.cookie_secure` earlier
2021-02-25 18:12:57 +01:00
tamcy
e82918cd60 [HttpKernel] Configure session.cookie_secure earlier 2021-02-25 18:11:33 +01:00
Nicolas Grekas
439742ff33 [HttpClient] Add HttpClientInterface::withOptions() 2021-02-25 17:38:04 +01:00
Wouter de Jong
45be875e84 [Security][RateLimiter] Allow to use no lock in the rate limiter/login throttling 2021-02-25 17:33:05 +01:00
Nicolas Grekas
e2f1c46734 feature #39883 [Uid] Add Generate and Inspect commands (fancyweb)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Uid] Add Generate and Inspect commands

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

After some time using the component, I realized I often needed to quickly generate new ulids or to convert them from one format to another so I thought having those commands would be useful.

# Usage

## Generate a ULID - outputs N ULID(s) separated by new lines in base 32, base 58 or RFC 4122 format

### Generate 1 ULID now
`php bin/console ulid:generate`

### Generate 1 ULID with a specific timestamp
`php bin/console ulid:generate --time="2021-02-02 14:00:00"`

### Generate 2 ULIDs and ouput the RFC4122 format
`php bin/console ulid:generate --count=2 --format=rfc4122`

## Generate a UUID - outputs N UUID(s) separated by new lines in RFC 4122, base 58 or base 32 format

### Generate 1 UUID (defaults from the underlying factory)
`php bin/console uuid:generate`

### Generate 1 time-based UUID now
`php bin/console uuid:generate --time-based=now`

### Generate 1 time-based UUID with a specific timestamp
`php bin/console uuid:generate --time-based="2021-02-02 14:00:00"`

### Generate 1 time-based UUID with a specific node
`php bin/console uuid:generate --time-based=now --node=fb3502dc-137e-4849-8886-ac90d07f64a7`

### Generate 1 name-based UUID (there must be a default namespace in the underlying factory)
`php bin/console uuid:generate --name-based=foo`

### Generate 1 name-based UUID with a specific namespace (overrides the default namespace from the underlying factory)
`php bin/console uuid:generate --name-based=foo --namespace=fb3502dc-137e-4849-8886-ac90d07f64a7`

### Generate 1 random-based UUID
`php bin/console uuid:generate --random-based`

### Generate 2 UUIDs and output their base 58 format
`php bin/console uuid:generate --count=2 --format=base58`

## Inspect a ULID - outputs base32, base58 and RFC 4122 formats of a ULID and its humand readable timestamp if it is time-based
`php bin/console ulid:inspect 01EWAKBCMWQ2C94EXNN60ZBS0Q`
`php bin/console ulid:inspect 1BVdfLn3ERmbjYBLCdaaLW`
`php bin/console ulid:inspect 01771535-b29c-b898-923b-b5a981f5e417`

## Inspect a UUID - outputs RFC 4122, base 58 and base 32 formats of a UUID and its human readable timestamp
`php bin/console uuid:inspect a7613e0a-5986-11eb-a861-2bf05af69e52`
`php bin/console uuid:inspect MfnmaUvvQ1h8B14vTwt6dX`
`php bin/console uuid:inspect 57C4Z0MPC627NTGR9BY1DFD7JJ`

# Register the commands

## YAML
```yaml
# services.yaml
services:
    Symfony\Component\Uid\Command\GenerateUlidCommand: ~
    Symfony\Component\Uid\Command\GenerateUuidCommand: ~
    Symfony\Component\Uid\Command\InspectUlidCommand: ~
    Symfony\Component\Uid\Command\InspectUuidCommand: ~
```

## PHP
```php
<?php

// services.php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\Uid\Command\GenerateUlidCommand;
use Symfony\Component\Uid\Command\GenerateUuidCommand;
use Symfony\Component\Uid\Command\InspectUlidCommand;
use Symfony\Component\Uid\Command\InspectUuidCommand;

return static function (ContainerConfigurator $configurator): void {
    $services = $configurator->services()
        ->defaults()
        ->autowire()
        ->autoconfigure();

    $services
        ->set(GenerateUlidCommand::class)
        ->set(GenerateUuidCommand::class)
        ->set(InspectUlidCommand::class)
        ->set(InspectUuidCommand::class);
};
```

Commits
-------

223421b6ca [Uid] Add Generate and Inspect commands
2021-02-25 17:25:32 +01:00
Nicolas Grekas
1849b571b5 feature #40140 [DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #40136, fix #39356
| License       | MIT
| Doc PR        | no need to

Leverages https://github.com/composer/composer/pull/9682 to ignore dev-packages when configuring the container.

Commits
-------

47c471e2c4 [DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration
2021-02-25 17:13:15 +01:00
Robin Chalas
adbb34115c Merge branch '5.2' into 5.x
* 5.2:
  [TwigBridge] Install symfony/intl to run tests on Travis
  [Translation] Make `name` attribute optional in xliff2
  [Security] #[CurrentUser] argument should resolve to null when it is anonymous
2021-02-25 14:42:49 +01:00
Robin Chalas
f4c9feeb75 Merge branch '4.4' into 5.2
* 4.4:
  [TwigBridge] Install symfony/intl to run tests on Travis
  [Translation] Make `name` attribute optional in xliff2
2021-02-25 14:42:30 +01:00
Wouter de Jong
b2970456bf [TwigBridge] Install symfony/intl to run tests on Travis 2021-02-25 12:27:58 +01:00
Fabien Potencier
d54a1223f7 feature #40266 [Routing] Construct Route annotations using named arguments (derrabus)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Routing] Construct Route annotations using named arguments

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

This PR proposes to bump the `doctrine/annotations` library to 1.12 to gain access to its emulation layer for named arguments. Furthermore, constructing a `Route` annotation the old way by passing an array of parameters is deprecated.

### Reasons for this change

The constructors of our annotation classes have become unnecessarily complicated because we have to support two ways of calling them:
* An array of parameters, passed as first argument, because that's the default behavior `doctrine/annotations`.
* A set of named arguments because that's how PHP 8 attributes work.

Since we can now tell the Doctrine annotation reader to use named arguments as well, we can simplify the constructors of our annotations significantly.

### Drawback

After this change, there is no easy way anymore to construct instances of the `Route` annotation class directly on PHP 7. The PR has been built under the assumption that instances of this class are usually created using either Doctrine annotations or a PHP 8 attribute. Thus, most applications should be unaffected by this change.

Commits
-------

29b0f96046 [Routing] Construct Route annotations using named arguments
2021-02-25 08:31:04 +01:00
Fabien Potencier
b44b9aa681 feature #40288 Deprecate passing null as $message or $code to exceptions (derrabus)
This PR was merged into the 5.3-dev branch.

Discussion
----------

Deprecate passing null as $message or $code to exceptions

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

Follow-up to #40271.

Following the example of the PHP core, this PR introduces deprecation warnings that are triggered if a developer attempts to pass null as `$code` or `$message` to an exception constructor.

Commits
-------

8e3058d95a Deprecate passing null as $message or $code to exceptions
2021-02-25 08:28:10 +01:00
Nyholm
f90d3ec203 [Form] Remove hard dependency on symfony/intl 2021-02-25 08:25:40 +01:00
Thomas Calvet
223421b6ca [Uid] Add Generate and Inspect commands
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
2021-02-24 18:32:23 +01:00
Marie Minasyan
97058559cc [Translation] Make name attribute optional in xliff2
Do not set a fake `name` attribute on `unit` element from xliff2 to allow using `source` attribute and avoid missing translation error
2021-02-24 17:01:00 +01:00
Nicolas Grekas
47c471e2c4 [DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration 2021-02-24 16:58:46 +01:00
Robin Chalas
b03731981a bug #40286 [Security] #[CurrentUser] arguments should resolve to null for "anon." (chalasr)
This PR was merged into the 5.2 branch.

Discussion
----------

[Security] #[CurrentUser] arguments should resolve to null for "anon."

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

The UserValueResolver should only resolve `UserInterface` (or subtype) typed arguments:
bc9e946a56/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php (L54-L55)
When using the `#CurrentUser` attribute with an AnonymousToken in the storage, the resolved argument value is `anon.`. This PR fixes it.

/cc @jvasseur

Commits
-------

8d3078dd35 [Security] #[CurrentUser] argument should resolve to null when it is anonymous
2021-02-24 15:02:23 +01:00
Robin Chalas
8d3078dd35 [Security] #[CurrentUser] argument should resolve to null when it is anonymous 2021-02-24 14:48:49 +01:00
Alexander M. Turek
8e3058d95a Deprecate passing null as $message or $code to exceptions 2021-02-24 14:36:13 +01:00
Alexander M. Turek
29b0f96046 [Routing] Construct Route annotations using named arguments 2021-02-24 14:30:32 +01:00
Alexander M. Turek
20e5441eb8 Merge branch '5.2' into 5.x
* 5.2:
  Switched to non-null defaults in exception constructors
  Allow x-forwarded-prefix trusted header.
2021-02-24 01:41:59 +01:00
Alexander M. Turek
2e865ac057 Switched to non-null defaults in exception constructors 2021-02-24 00:58:19 +01:00
Jérémy Derussé
483f840a08
Remove service session.storage.mock_file when user configure factory 2021-02-23 23:31:03 +01:00
Pol Dellaiera
95fdd90491 Allow x-forwarded-prefix trusted header. 2021-02-23 16:58:22 +01:00
Nicolas Grekas
bc9e946a56 Merge branch '5.2' into 5.x
* 5.2:
  Move github templates at the org level
  [Cache] Fix Redis TLS scheme `rediss` for Redis connection
  In calls to mb_ functions, silently transform arg into string
  Switched to non-null defaults in exception constructors
  [Routing] fix conflict with param named class in attribute
  [Cache] fix setting items' metadata on commit()
2021-02-23 11:10:15 +01:00
Nicolas Grekas
e98ab925e3 Merge branch '4.4' into 5.2
* 4.4:
  Move github templates at the org level
  [Cache] Fix Redis TLS scheme `rediss` for Redis connection
  In calls to mb_ functions, silently transform arg into string
2021-02-23 11:08:49 +01:00
Nyholm
8e1d3285ed
Adding templates for Belarusian 2021-02-22 22:11:34 +01:00
Nicolas Grekas
b5dc77ea16 minor #40272 [Console] Handle calls to mb_ functions with non string arguments (Yopai)
This PR was merged into the 4.4 branch.

Discussion
----------

[Console] Handle calls to mb_ functions with non string arguments

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

In PHP8.1, a number of functions who were accepting null arguments will only accept
string ones.
(see https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg)

In the polyfill, mb_* functions are already declared with a strict type checking of "string".

Therefore, it is necessary to get rid of the use of non string arguments when calling mb_* functions,
so that it won't break when either using the polyfill,or future php8 versions.

In every call where the argument may not be a string, this commit enforces the string type of the argument (with transtyping)

--- For reviewers
* I generally don't like transtyping, but found it was the more "secure" way (on a non-BC point of view) here.
Specially in Console/Helper/Table.php, where $cell can be an object (there are 2 "$cell instanceof ... tests)
However, where the argument can already be either null or string (and not anything else), there may a beter approach ?

* It's the first time I send a PR on symfony, so don't hesitate pointing me to thinks I've forgotten to done.

Commits
-------

ac45be2580 In calls to mb_ functions, silently transform arg into string
2021-02-22 19:44:15 +01:00
Mickaël Isaert
3288897e0f [Cache] Fix Redis TLS scheme rediss for Redis connection 2021-02-22 19:01:38 +01:00
Pierre-Olivier Vares
ac45be2580 In calls to mb_ functions, silently transform arg into string
In PHP8, a number of functions who were accepting null arguments will only accept
string ones.

In the polyfill, mb_* functions are declared with a trict type checking of "string".

Therefore, we deprecate the use of non string arguments, so that it won't break when either using the polyfill,
or future php8 versions.
2021-02-22 18:49:23 +01:00
Nicolas Grekas
3619ae8ea4 Merge branch '4.4' into 5.2
* 4.4:
  Switched to non-null defaults in exception constructors
  [Routing] fix conflict with param named class in attribute
  [Cache] fix setting items' metadata on commit()
2021-02-22 16:48:39 +01:00
Nicolas Grekas
f3529fd9df minor #40271 Switched to non-null defaults in exception constructors (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

Switched to non-null defaults in exception constructors

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

PHP 8.1 will trigger a deprecation warning if we pass `null` as `$message` or `$code` to the constructor of `\Exception`. However, many of our own exception accept `null` for those parameters and even use them as default.

This is unfortunate because code like the following snippet would trigger that deprecation although the code itself is perfectly fine:

```php
throw new NotFoundHttpException();
```

With this PR, I'd like to change our defaults to `''` and `0` while still allowing to pass `null` for BC. In a follow-up PR for the 5.x branch, I'd like to deprecate passing `null`, matching the future behavior of PHP.

This PR also adjust various PHPDoc blocks with inaccurate types.

Commits
-------

f8e10094a4 Switched to non-null defaults in exception constructors
2021-02-22 16:37:04 +01:00
Alexander M. Turek
f8e10094a4 Switched to non-null defaults in exception constructors 2021-02-22 16:36:50 +01:00
Nicolas Grekas
070f003291 bug #40244 [Routing] fix conflict with param named class in attribute (nlhommet)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Routing] fix conflict with param named class in attribute

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

Fix conflict with AnnotationFileLoader and class PHP8 Attribute with param named "class"

Commits
-------

27bba684d8 [Routing] fix conflict with param named class in attribute
2021-02-22 16:26:26 +01:00
Nicolas LHommet
27bba684d8 [Routing] fix conflict with param named class in attribute 2021-02-22 16:26:18 +01:00
Nicolas Grekas
9bb4b3106d [Cache] fix setting items' metadata on commit() 2021-02-22 12:06:49 +01:00
Nicolas Grekas
858dca485d feature #40214 [FrameworkBundle] allow container/routing configurators to vary by env (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] allow container/routing configurators to vary by env

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

Inspired by https://github.com/symfony/webpack-encore/pull/900 and by a chat on Slack with @weaverryan

This aims at allowing conditional configuration, which would allow merging config files in one.

Using the PHP-DSL:
```php
$container
    ->when(env: 'prod')
    ->services()
        ->set(Foo::class)
    //...
```

In Yaml:
```yaml
framework:
    secret: '%env(APP_SECRET)%'

when@dev:
    services:
        App\FooForDev: ~

when@test:
    framework:
        test: true
        session:
            storage_factory_id: session.storage.mock_file
```

In XML (omitting namespaces):
```xml
<when env="test">
	<framework test="true">
		<!-- ... -->
	</framework>
</when>

```

A similar syntax is also provided for routes, with support for annotations:
`@Route(env="prod")` defines a route that is enabled only on the "prod" env.

Commits
-------

108375b068 [FrameworkBundle] allow container/routing configurators to vary by env
2021-02-22 09:45:48 +01:00
Alexander M. Turek
bf30fa45ee Merge branch '5.2' into 5.x
* 5.2:
  [Form] Ignoring invalid forms from delete_empty behavior in CollectionType
  Add Symfony Armenian Translations
  cs fix
  Add different header notations to tests
2021-02-22 07:55:17 +01:00
Alexander M. Turek
8cec0b6391 Merge branch '4.4' into 5.2
* 4.4:
  [Form] Ignoring invalid forms from delete_empty behavior in CollectionType
  Add Symfony Armenian Translations
  cs fix
  Add different header notations to tests
2021-02-22 07:48:33 +01:00
Fabien Potencier
8054d1d04c bug #40258 [Form] Ignoring invalid forms from delete_empty behavior in CollectionType (yceruto)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Form] Ignoring invalid forms from delete_empty behavior in CollectionType

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

As expained on linked issue, empty forms cannot be removed if they are invalid upon submitting (e.g. transformation failures). Thus, form errors can be displayed properly to the end user.

Commits
-------

e4911554e3 [Form] Ignoring invalid forms from delete_empty behavior in CollectionType
2021-02-21 18:50:09 +01:00
Yonel Ceruto
e4911554e3 [Form] Ignoring invalid forms from delete_empty behavior in CollectionType 2021-02-21 18:50:02 +01:00
Fabien Potencier
bda90dfd2f minor #40223 Add Symfony Armenian Translations (ErikSaunier)
This PR was merged into the 4.4 branch.

Discussion
----------

Add Symfony Armenian Translations

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

Added missing armenian translations for Form components

Commits
-------

d1c3e21eff Add Symfony Armenian Translations
2021-02-21 18:47:22 +01:00
Nicolas Grekas
e15ac7ad97 minor #40253 [BrowserKit] Add different header notations to tests (malteschlueter)
This PR was merged into the 4.4 branch.

Discussion
----------

[BrowserKit] Add different header notations to tests

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

In the past there was a issue #29736 that the header wasn't processed correctly. To reproduce and prevent this behaviour i extended the tests for this. At the end everything is fine, also in 5.x branch. See bf03d6889d.

Commits
-------

251ce8f924 Add different header notations to tests
2021-02-20 18:06:12 +01:00
Nicolas Grekas
5cfe73d954 feature #40257 [Intl] Add Currencies::getCashFractionDigits() and Currencies::getCashRoundingIncrement() (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Intl] Add `Currencies::getCashFractionDigits()` and `Currencies::getCashRoundingIncrement()`

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

Commits
-------

dab91f78e1 [Intl] Add `Currencies::getCashFractionDigits()` and `Currencies::getCashRoundingIncrement()`
2021-02-19 20:02:01 +01:00
Wouter de Jong
b8f5b7ab3b [#39326] Fix PHP 7.2 heredoc syntax 2021-02-19 19:16:31 +01:00
Erik Saunier
d1c3e21eff Add Symfony Armenian Translations 2021-02-19 18:17:03 +01:00
Wouter de Jong
70ef5b364c feature #39326 [Security] Added debug:firewall command (TimoBakx)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Security] Added debug:firewall command

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #39321
| License       | MIT
| Doc PR        | symfony/symfony-docs#14982
| Tags | #SymfonyHackday

### Subtasks
- [x] Add list view (for use without arguments)
- [x] Add more information to list view
- [x] Add detail view (for use with `firewall` argument)
- [x] Add more information to detail view table
- [x] Add authenticators list
- [x] Add event listeners & events (copy from `debug:event-listener`)
- [x] Add `--include-listeners` option (default: false)
- [x] Add helptext
- [x] Add documentation

### Moved outside of current scope
- Add allowed badges

### Usage (and example output) for a list
`bin/console debug:firewall`

```
Firewalls
=========

 The following firewalls are defined:
 --------
  Name
 --------
  dev
  public
  main
 --------

 // To view details of a specific firewall, re-run this command with a firewall name. (e.g. debug:firewall
 // main)
```

### Usage (and example output) for details
`bin/console debug:firewall main`

```
Firewall "main"
===============

 ----------------------- ---------------------------------------------------
  Option                  Value
 ----------------------- ---------------------------------------------------
  Name                    main
  Context                 main
  Lazy                    Yes
  Stateless               No
  User Checker            security.user_checker
  Provider                security.user.provider.concrete.app_user_provider
  Entry Point             App\Security\LoginFormAuthenticator
  Access Denied URL
  Access Denied Handler
 ----------------------- ---------------------------------------------------

User switching
--------------

 ----------- ---------------------------------------------------
  Option      Value
 ----------- ---------------------------------------------------
  Parameter   test
  Provider    security.user.provider.concrete.app_user_provider
  User Role   ROLE_SWITCH_POSSIBLE
 ----------- ---------------------------------------------------

Event listeners for firewall "main"
===================================

"Symfony\Component\Security\Http\Event\LoginSuccessEvent" event
---------------------------------------------------------------

 ------- -------------------------------------------------------------------------------------------- ----------
  Order   Callable                                                                                     Priority
 ------- -------------------------------------------------------------------------------------------- ----------
  #1      Symfony\Component\Security\Http\EventListener\UserCheckerListener::postCheckCredentials()    256
  #2      Symfony\Component\Security\Http\EventListener\SessionStrategyListener::onSuccessfulLogin()   0
  #3      Symfony\Component\Security\Http\EventListener\RememberMeListener::onSuccessfulLogin()        0
  #4      App\Security\UpdateLastLogin::__invoke()                                                     0
  #5      Symfony\Component\Security\Http\EventListener\PasswordMigratingListener::onLoginSuccess()    0
 ------- -------------------------------------------------------------------------------------------- ----------

"Symfony\Component\Security\Http\Event\LogoutEvent" event
---------------------------------------------------------

 ------- ------------------------------------------------------------------------------------------- ----------
  Order   Callable                                                                                    Priority
 ------- ------------------------------------------------------------------------------------------- ----------
  #1      Symfony\Component\Security\Http\EventListener\DefaultLogoutListener::onLogout()             64
  #2      Symfony\Component\Security\Http\EventListener\SessionLogoutListener::onLogout()             0
  #3      Symfony\Component\Security\Http\EventListener\RememberMeLogoutListener::onLogout()          0
  #4      Symfony\Component\Security\Http\EventListener\CsrfTokenClearingLogoutListener::onLogout()   0
 ------- ------------------------------------------------------------------------------------------- ----------

"Symfony\Component\Security\Http\Event\CheckPassportEvent" event
----------------------------------------------------------------

 ------- ------------------------------------------------------------------------------------------ ----------
  Order   Callable                                                                                   Priority
 ------- ------------------------------------------------------------------------------------------ ----------
  #1      Symfony\Component\Security\Http\EventListener\LoginThrottlingListener::checkPassport()     2080
  #2      Symfony\Component\Security\Http\EventListener\UserProviderListener::checkPassport()        2048
  #3      Symfony\Component\Security\Http\EventListener\UserProviderListener::checkPassport()        1024
  #4      Symfony\Component\Security\Http\EventListener\CsrfProtectionListener::checkPassport()      512
  #5      Symfony\Component\Security\Http\EventListener\UserCheckerListener::preCheckCredentials()   256
  #6      App\Security\DisallowBannedUsers::__invoke()                                               0
  #7      Symfony\Component\Security\Http\EventListener\CheckCredentialsListener::checkPassport()    0
 ------- ------------------------------------------------------------------------------------------ ----------

"Symfony\Component\Security\Http\Event\LoginFailureEvent" event
---------------------------------------------------------------

 ------- ----------------------------------------------------------------------------------- ----------
  Order   Callable                                                                            Priority
 ------- ----------------------------------------------------------------------------------- ----------
  #1      Symfony\Component\Security\Http\EventListener\RememberMeListener::onFailedLogin()   0
 ------- ----------------------------------------------------------------------------------- ----------

Authenticators for firewall "main"
==================================

 // @TODO: List authenticator information

```

Commits
-------

a9dea1db56 [Security] Added debug:firewall command
2021-02-19 18:14:39 +01:00
Timo Bakx
a9dea1db56
[Security] Added debug:firewall command 2021-02-19 18:09:29 +01:00
Nicolas Grekas
dab91f78e1 [Intl] Add Currencies::getCashFractionDigits() and Currencies::getCashRoundingIncrement() 2021-02-19 16:39:40 +01:00
Nicolas Grekas
1329689ace cs fix 2021-02-19 10:48:50 +01:00
Nicolas Grekas
108375b068 [FrameworkBundle] allow container/routing configurators to vary by env 2021-02-19 08:25:52 +01:00
Robin Chalas
dc2635c654 feature #40234 [Console] Add ConsoleCommand attribute for declaring commands on PHP 8 (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Console] Add `ConsoleCommand` attribute for declaring commands on PHP 8

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

Builds on #39851

On PHP8, this PR will allow using an attribute instead of the public static properties for the name and the description.

```php

#[ConsoleCommand(
	name: 'app:my-command',
	description: '🌈',
	hidden: true,
	aliases: ['🌈'],
)]
class MyCommand extends Command
{
}
```

Commits
-------

0cbc9cc672 [Console] Add `ConsoleCommand` attribute for declaring commands on PHP 8
2021-02-19 01:04:43 +01:00
Nicolas Grekas
e58b91cf16 Merge branch '5.2' into 5.x
* 5.2:
  [VarDumper] relax test case
2021-02-19 00:11:25 +01:00
Nicolas Grekas
978a9b8204 [VarDumper] relax test case 2021-02-19 00:11:19 +01:00
Nicolas Grekas
21bc5bf137 Merge branch '5.2' into 5.x
* 5.2:
  [VarDumper] relax test case
2021-02-19 00:03:08 +01:00
Nicolas Grekas
acf4c3370c [VarDumper] relax test case 2021-02-19 00:03:02 +01:00
Nicolas Grekas
d146b0c953 Merge branch '5.2' into 5.x
* 5.2:
  [VarDumper] relax test case
2021-02-19 00:02:00 +01:00
Nicolas Grekas
279e71f5f3 [VarDumper] relax test case 2021-02-19 00:01:52 +01:00
Nicolas Grekas
8040f14f04 Merge branch '5.2' into 5.x
* 5.2:
  Stop using deprecated ArrayCache from Doctrine
  [EventDispatcher] fix registering subscribers twice on edge-case
  [Intl] fix Locale::getFallback() throwing exception on long $locale
2021-02-18 23:42:52 +01:00
Nicolas Grekas
11912f8c69 Merge branch '4.4' into 5.2
* 4.4:
  Stop using deprecated ArrayCache from Doctrine
  [Intl] fix Locale::getFallback() throwing exception on long $locale
2021-02-18 23:42:36 +01:00
Nicolas Grekas
15f021f825 Stop using deprecated ArrayCache from Doctrine 2021-02-18 23:27:55 +01:00
Nicolas Grekas
ad60072998 [EventDispatcher] fix registering subscribers twice on edge-case 2021-02-18 18:12:37 +01:00
Nicolas Grekas
8aaa1520f4 bug #40243 [EventDispatcher] add missing "dispatcher" property on #[EventListener] (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[EventDispatcher] add missing "dispatcher" property on #[EventListener]

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

Commits
-------

4718fc2b1d [EventDispatcher] add missing "dispatcher" property on #[EventListener]
2021-02-18 17:57:04 +01:00
Nicolas Grekas
7966517976 [PropertyInfo] fix direct deprecation 2021-02-18 17:47:29 +01:00
Nicolas Grekas
4718fc2b1d [EventDispatcher] add missing "dispatcher" property on #[EventListener] 2021-02-18 17:19:14 +01:00
Nicolas Grekas
0cbc9cc672 [Console] Add ConsoleCommand attribute for declaring commands on PHP 8 2021-02-18 12:02:40 +01:00
Malte Schlüter
251ce8f924 Add different header notations to tests 2021-02-18 11:52:56 +01:00
Alexander M. Turek
2ab3caf080 [DependencyInjection] Autoconfigurable attributes 2021-02-17 20:42:09 +01:00
bahram
a89ced8eac [Intl] fix Locale::getFallback() throwing exception on long $locale 2021-02-17 16:45:29 +01:00
Christian Flothmann
f50e6afd7d Merge branch '5.2' into 5.x
* 5.2:
  install compatible versions of mongodb/mongodb only
  fix taking error message from the correct violation
  fix resolving parent/self/static type annotations
  [Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name
  [WebLink] Escape double quotes in attributes values
  [String] Check if function exists before declaring it
2021-02-17 16:27:35 +01:00
Christian Flothmann
e3b0c8868c Merge branch '4.4' into 5.2
* 4.4:
  install compatible versions of mongodb/mongodb only
  fix resolving parent/self/static type annotations
  [Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name
  [WebLink] Escape double quotes in attributes values
2021-02-17 16:24:54 +01:00
Robin Chalas
79de1da6ca [Security] Fix some broken BC layers 2021-02-16 20:02:45 +01:00
Christian Flothmann
32cd77aecc fix taking error message from the correct violation 2021-02-16 14:22:25 +01:00
Nicolas Grekas
c1c20860e5 bug #40208 [PropertyInfo] fix resolving self to name of the analyzed class (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[PropertyInfo] fix resolving self to name of the analyzed class

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

Commits
-------

e9f2ece991 fix resolving parent/self/static type annotations
2021-02-16 13:45:38 +01:00
Christian Flothmann
e9f2ece991 fix resolving parent/self/static type annotations 2021-02-16 13:45:26 +01:00
Fabien Potencier
f8ce7d0803 bug #40209 [WebLink] Escape double quotes in attributes values (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[WebLink] Escape double quotes in attributes values

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

If the attribute value contains a double quote, the serialized value is invalid: `</foo>; rel="alternate"; title="foo " bar"`. Ideally we would use `addcslashes` but we can't because users that already pass escaped values would then be impacted.

Commits
-------

7946be2b95 [WebLink] Escape double quotes in attributes values
2021-02-16 13:01:27 +01:00
Yendric
0e421004eb [Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name 2021-02-16 12:16:02 +01:00
Thomas Calvet
7946be2b95 [WebLink] Escape double quotes in attributes values 2021-02-16 12:01:18 +01:00
Nicolas Grekas
7dcf156242 bug #40203 [String] Check if function exists before declaring it (Nyholm)
This PR was squashed before being merged into the 5.2 branch.

Discussion
----------

[String] Check if function exists before declaring it

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

If you installed a command line tool like `psalm` with composer and then try to run it on a project that included the String component you will get an error like:

> Fatal error: Cannot redeclare Symfony\Component\String\u() (previously declared in /Workspace/symfony/src/Symfony/Component/String/Resources/functions.php:14) in /user/.composer/vendor/symfony/string/Resources/functions.php on line 14

That is because we are loading two installations of the string component.

Commits
-------

cc00e0eb78 [String] Check if function exists before declaring it
2021-02-16 11:20:41 +01:00
Nyholm
cc00e0eb78 [String] Check if function exists before declaring it 2021-02-16 11:20:28 +01:00
Nicolas Grekas
4d91b8f5c2 feature #39804 [DependencyInjection] Add #[Autoconfigure] to help define autoconfiguration rules (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[DependencyInjection] Add `#[Autoconfigure]` to help define autoconfiguration rules

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

Being inspired by the discussion with @derrabus in #39776.

This PR allows declaring autoconfiguration rules using an attribute on classes/interfaces, eg:
`#[Autoconfigure(bind: ['$foo' => 'bar'], tags: [...], calls: [...])]`

This should typically be added on a base class/interface to tell *how* implementations of such a base type should be autoconfigured. The attribute is parsed when autoconfiguration is enabled, except when a definition has the `container.ignore_attributes` tag, which allows opting out from this behavior.

As usual, the corresponding rules are applied only to services that have autoconfiguration enabled.

In practice, this means that this enables auto-tagging of all implementations of this interface:
```php
#[Autoconfigure(tags: ['my_tag'])]
interface MyInterface {...}
```

Of course, all auto-configurable settings are handled (calls, bindings, etc.)

This PR adds another attribute: `#[AutoconfigureTag()]`.

It extends `#[Autoconfigure]` and allows for specifically defining tags to attach by autoconfiguration.

The name of the tag is optional and defaults to the name of the tagged type (typically the FQCN of an interface). This should ease with writing locators/iterators of tagged services.

```php
#[AutoconfigureTag()]
interface MyInterface {...}
```

Commits
-------

64ab6a2850 [DependencyInjection] Add `#[Autoconfigure]` to help define autoconfiguration rules
2021-02-16 11:14:56 +01:00
Nicolas Grekas
857cf336a1 Merge branch '5.2' into 5.x
* 5.2:
  Ignore indirect deprecation triggered by doctrine/orm
  Symfony Armenian Translations
  [Translation] Allow using dashes in locale when linting Xliff files
  use the right context for properties defined in traits
2021-02-16 11:14:08 +01:00
Nicolas Grekas
00b4b76460 Merge branch '4.4' into 5.2
* 4.4:
  Ignore indirect deprecation triggered by doctrine/orm
  Symfony Armenian Translations
  [Translation] Allow using dashes in locale when linting Xliff files
  use the right context for properties defined in traits
2021-02-16 11:13:48 +01:00
Nicolas Grekas
64ab6a2850 [DependencyInjection] Add #[Autoconfigure] to help define autoconfiguration rules 2021-02-16 11:05:17 +01:00
Fabien Potencier
c54bfb779c feature #40174 [Mailer] AWS SES transport Source ARN header support (chekalsky)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Mailer] AWS SES transport Source ARN header support

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        | need help (this part was never mentioned in docs)

AWS SES API has [FromEmailAddressIdentityArn](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html#SES-SendEmail-request-FromEmailAddressIdentityArn) field which is necessary for using identities verified by different AWS account.

With this PR I am adding ability to set this field via setting `X-SES-SOURCE-ARN` header.

I've added support for this API field in the same way as it was done before for `X-SES-CONFIGURATION-SET`. It was never documented, but you can use header `X-SES-CONFIGURATION-SET` to set `ConfigurationSetName` API param.

Commits
-------

d7225db7d5 [Mailer] AWS SES transport Source ARN header support
2021-02-16 08:13:33 +01:00
Ilya Chekalsky
d7225db7d5 [Mailer] AWS SES transport Source ARN header support 2021-02-16 08:13:27 +01:00
Tigran Azatyan
93fe4a213e Symfony Armenian Translations 2021-02-16 08:10:14 +01:00
Fabien Potencier
1262b060e7 feature #38473 [Framework] Add tag assets.package to register asset packages (GromNaN)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Framework] Add tag assets.package to register asset packages

Replaces #38366

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

To configure asset packages in an application, we have to declare it in the `framework` configuration ([doc for assets config](https://symfony.com/doc/current/reference/configuration/framework.html#assets)). In some case we cannot use this configuration:
- To use a custom class as package
- To register an asset package in a shared bundle (my use-case).

This PR adds the `assets.package` tag. This tag is use to collect and inject package services into the `assets.packages` service, that is the registry for all packages. Since every package needs a name, the `package` attribute of the tag is used (same naming convention that the `console.command` tag).

Main changes:
- the packages defined in the `framework.assets` configuration are injected into the `assets.packages` using the tag instead of being directly injected in service declaration.
- changed signature of `Symfony\Components\Assets\Packages` constructor to accept an iterator (backward compatible).
- a new alias `assets._default_package` is defined even if assets are not configured.

### Example in `symfony/demo` ([commit](e5e5a8fff0...GromNaN:assets-package-tag)):

In `config/services.yaml`:
```yaml
    avatar.strategy:
        class: Symfony\Component\Asset\VersionStrategy\JsonManifestVersionStrategy
        arguments:
            - '%kernel.project_dir%/public/build/manifest.json'

    avatar.package:
        class:  Symfony\Component\Asset\Package
        arguments:
            - '@avatar.strategy'
            - '@assets.context'
        tags:
            - { name: assets.package, package: avatars }
```

Then we can use the package anywhere
```twig
<img src="{{ asset('anna.jpg', 'avatars') }}">
```

### Alternative using autoconfiguration with a custom class:

With a custom class implementing the `PackageInterface`, the package name can be provided by a the static method `getDefaultPackageName`. Autowiring and autoconfiguration will import the package.

```php
namespace App\Asset;

use Symfony\Component\Asset\PackageInterface;

class AvatarPackage implements PackageInterface
{
    public static function getDefaultPackageName(): string
    {
        return 'avatars';
    }

    // ... Implements the interface
}
```

Commits
-------

6217ff7b6f [Asset] Add tag assets.package to register asset packages
2021-02-16 08:00:54 +01:00
Fabien Potencier
e2b1d9cd5a feature #39399 [Serializer] Allow to provide (de)normalization context in mapping (ogizanagi)
This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[Serializer] Allow to provide (de)normalization context in mapping

| 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 #39039 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | TODO <!-- required for new features -->

As explained in the linked feature request, this brings the ability to configure context on a per-property basis, using Serializer mapping.

Considering:

```php
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;

class Foo
{
    /**
     * @Serializer\Context({ DateTimeNormalizer::FORMAT_KEY = 'Y-m-d' })
     */
    public \DateTime $date;

    public \DateTime $anotherDate;
}
```

`$date` will be formatted with a specific format, while `$anotherDate` will use the default configured one (or the one provided in the context while calling `->serialize()` / `->normalize()`).

It can also differentiate normalization and denormalization contexts:

```php
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;

class Foo
{
    /**
     * @Serializer\Context(
     *   normalizationContext = { DateTimeNormalizer::FORMAT_KEY = 'Y-m-d' },
     *   denormalizationContext = { DateTimeNormalizer::FORMAT_KEY = \DateTime::COOKIE },
     * )
     */
    public \DateTime $date;
}
```

As well as act differently depending on groups:

```php
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;

class Foo
{
    /**
     * @Serializer\Groups({ "extended" })
     * @Serializer\Context({ DateTimeNormalizer::FORMAT_KEY = \DateTime::RFC3339 })
     * @Serializer\Context(
     *   context = { DateTimeNormalizer::FORMAT_KEY = \DateTime::RFC3339_EXTENDED },
     *   groups = {"extended"},
     * )
     */
    public \DateTime $date;
}
```

The annotation can be repeated as much as you want to handle the different cases.
Context without groups is always applied first, then context for groups are merged in the provided order.
Context provided when calling `->serialize()` / `->normalize()` acts as the defaults for the properties without context provided in the metadata.

XML mapping (see tests) is a lot verbose due to the required structure to handle groups.

Such metadata contexts are also forwarded to name converters, max depth handlers, callbacks, ...

Of course, PHP 8 attributes are also supported:

```php
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;

class Foo
{
    #[Serializer\Groups(["extended"])]
    #[Serializer\Context([DateTimeNormalizer::FORMAT_KEY => \DateTime::RFC3339])]
    #[Serializer\Context(
      context: [DateTimeNormalizer::FORMAT_KEY => \DateTime::RFC3339_EXTENDED],
      groups: ["extended"],
    )]
    public \DateTime $date;
}
```

The PR should be ready for first batch of reviews / discussions.

- [x] Make Fabbot happy in 5.2
- [x] Missing `@Context` unit tests
- [x] rework xml & phpize values
- [x] Fix lowest build issue with annotations => bumped doctrine annotations to 1.7, as for other components

Commits
-------

7229fa1d8f [Serializer] Allow to provide (de)normalization context in mapping
2021-02-16 07:56:07 +01:00
Maxime Steinhausser
7229fa1d8f [Serializer] Allow to provide (de)normalization context in mapping 2021-02-16 07:56:01 +01:00
Fabien Potencier
1b358fef04 bug #40175 [PropertyInfo]  use the right context for properties defined in traits (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[PropertyInfo]  use the right context for properties defined in traits

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

Commits
-------

1572491a8a use the right context for properties defined in traits
2021-02-16 07:44:52 +01:00
Fabien Potencier
aa21944d37 bug #40172 [Translation] Allow using dashes in locale when linting Xliff files (localheinz)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Translation] Allow using dashes in locale when linting Xliff files

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

This pull request

* [x] asserts that the `XliffLintCommand` succeeds linting an Xliff file where both the the target language and the locale in the file name use dashes as separators
* [x] adjusts the `XliffLintCommand` to allow using the same value for target language and locale in the corresponding file name

Commits
-------

d106aa3f2d [Translation] Allow using dashes in locale when linting Xliff files
2021-02-16 07:36:55 +01:00
Andreas Möller
d106aa3f2d [Translation] Allow using dashes in locale when linting Xliff files 2021-02-16 07:36:48 +01:00
Robin Chalas
a4c5edc5ff Merge branch '5.2' into 5.x
* 5.2:
  [Workflow] Re-add InvalidTokenConfigurationException for BC
  Fix PHP 8.1 null values
  [Console] Fix PHP 8.1 null error for preg_match flag
  Fix: Article
  Definition::removeMethodCall should remove all matching calls
  [HttpFoundation] Fix typo in exception message
  mark the LazyIterator class as internal
  fix extracting mixed type-hinted property types
  [Worflow] Fixed GuardListener when using the new Security system
  keep valid submitted choices when additional choices are submitted
2021-02-15 19:57:44 +01:00
Robin Chalas
4365af6ce8 Merge branch '4.4' into 5.2
* 4.4:
  Fix PHP 8.1 null values
  [Console] Fix PHP 8.1 null error for preg_match flag
  Fix: Article
  Definition::removeMethodCall should remove all matching calls
  mark the LazyIterator class as internal
  fix extracting mixed type-hinted property types
  keep valid submitted choices when additional choices are submitted
2021-02-15 19:55:04 +01:00
Robin Chalas
6ed759189d [Workflow] Deprecate InvalidTokenConfigurationException 2021-02-15 15:47:12 +01:00
Robin Chalas
b596568db9 [Workflow] Re-add InvalidTokenConfigurationException for BC 2021-02-15 15:36:09 +01:00
Grégoire Pineau
b15bfc45d6 bug #39671 [Worflow] Fixed GuardListener when using the new Security system (lyrixx)
This PR was merged into the 5.2 branch.

Discussion
----------

[Worflow] Fixed GuardListener when using the new Security system

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

Commits
-------

bd26a79461 [Worflow] Fixed GuardListener when using the new Security system
2021-02-15 15:23:01 +01:00
Christian Flothmann
4ee48c44e5 minor #40180 Fix: Article (localheinz)
This PR was merged into the 4.4 branch.

Discussion
----------

Fix: Article

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

This pull request

* [x] fixes usages of the indefinite article `a` where `an` should be used instead

Commits
-------

34b320ba97 Fix: Article
2021-02-15 12:26:08 +01:00
Christian Flothmann
e62ef2adb7 bug #40187 [Console] Fix PHP 8.1 null error for preg_match flag (kylekatarnls)
This PR was merged into the 4.4 branch.

Discussion
----------

[Console] Fix PHP 8.1 null error for preg_match flag

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

Since PHP 8.1, `null` is no longer accepted as `$flags` in `preg_match`, default integer `0` value should be used instead.

Commits
-------

52f02e529a [Console] Fix PHP 8.1 null error for preg_match flag
2021-02-15 12:24:13 +01:00
Christian Flothmann
0574c1586a bug #39659 [Form] keep valid submitted choices when additional choices are submitted (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Form] keep valid submitted choices when additional choices are submitted

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

Commits
-------

85989c3678 keep valid submitted choices when additional choices are submitted
2021-02-15 12:22:00 +01:00
Christian Flothmann
1572491a8a use the right context for properties defined in traits 2021-02-15 10:02:53 +01:00
Kyle
419e2206f4
Fix PHP 8.1 null values
Both `stripos` and `preg_match` will no longer accept `null` on PHP >= 8.1
2021-02-14 19:51:53 +01:00
Kyle
52f02e529a
[Console] Fix PHP 8.1 null error for preg_match flag
Since PHP 8.1, null is no longer accepted as $flags, default integer `0` value should be used instead.
2021-02-14 19:19:55 +01:00
Fabien Potencier
5f8c736303 Fix package name 2021-02-14 18:34:21 +01:00
Robin Chalas
a8850a4813 minor #40183 [PasswordHasher] Fix: Use algorithm instead of algo (localheinz)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[PasswordHasher] Fix: Use algorithm instead of algo

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

This pull request

* [x] renames fields, variables, and parameters using `algos` or `algo` (which appear to be entirely made-up words) to `algorithms` and `algorithm` respectively

Commits
-------

a4dd14b478 Fix: Use algorithm instead of algo
2021-02-14 15:41:30 +01:00
Andreas Möller
a4dd14b478
Fix: Use algorithm instead of algo 2021-02-14 15:20:17 +01:00
Andreas Möller
2102170e43
Fix: Run 'php-cs-fixer fix' 2021-02-14 15:12:38 +01:00
Robin Chalas
702a3ee82f feature #40176 [PasswordHasher] Use bcrypt as default hash algorithm for "native" and "auto" (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[PasswordHasher] Use bcrypt as default hash algorithm for "native" and "auto"

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

As suggested in https://github.com/symfony/symfony/pull/39802#issuecomment-776790017,  based on https://twitter.com/TerahashCorp/status/1155129705034653698

Commits
-------

332817ac29 Use bcrypt as default password hash algorithm for "native" and "auto"
2021-02-14 15:05:49 +01:00
Andreas Möller
3fbf7e963d
Fix: Typo 2021-02-14 14:37:28 +01:00
Robin Chalas
332817ac29 Use bcrypt as default password hash algorithm for "native" and "auto" 2021-02-14 14:22:26 +01:00
Andreas Möller
34b320ba97
Fix: Article 2021-02-14 13:29:41 +01:00
Ruud Kamphuis
944ba23b58 Definition::removeMethodCall should remove all matching calls
It would only remove the first match, leaving the other method call(s) there to exist. This leads to unexpected situations.
2021-02-14 12:22:33 +01:00
Fabien Potencier
163df1e673 feature #40048 [FrameworkBundle] Deprecate session.storage service (jderusse)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] Deprecate session.storage service

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

Following the deprecation of `session` service, this PR deprecate other services that contains state: `session.storage`
- `session.storage`
- `session.storage.native`, `session.storage.php_bridge` and `session.storage.mock_file`
- `session.storage.metadata_bag`

Because people can inject / decorate override all these services, providing a migration path like I did with `session` would have been very hard. That's why, I added a new `opt-in` flag:

When people use `framework.session: true` or `framework.session.storage_id` the previous behavior is kept and deprecation are triggered when accessing the services.
But when people use the new `framework.session.storage_factory_id` configuration, the previous services (`session.storage.*`) are deleted (in case people would try to inject the legacy `session.storage*` services and would have expect to manipulate the same objects as the object injected in the session)

Commits
-------

37c591516a Deprecate session.storage
2021-02-14 11:40:26 +01:00
Fabien Potencier
4a32fd0446 bug #40160 [PropertyInfo] fix extracting mixed type-hinted property types (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[PropertyInfo] fix extracting mixed type-hinted property types

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

Commits
-------

be6432ee4c fix extracting mixed type-hinted property types
2021-02-14 11:36:42 +01:00
Fabien Potencier
2f0bc30e38 Fix CS 2021-02-14 11:23:24 +01:00
Beno!t POLASZEK
56545fd270 [DependencyInjection] Negated (not:) env var processor 2021-02-14 11:22:13 +01:00
Jérémy Derussé
37c591516a
Deprecate session.storage 2021-02-13 15:58:50 +01:00
Wouter de Jong
c757845643 feature #39802 [Security] Extract password hashing from security-core - with proper wording (chalasr)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Security] Extract password hashing from security-core - with proper wording

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

This PR renames password "encoders" to password _hashers_ (naming widely used, see e.g. django or laravel).
This also takes the opportunity to extract the logic related to password hashing from security-core, moving it to a new password-hasher component.
Nowadays, many modern web apps and APIs don't deal with passwords at all, that's why splitting makes sense as a step towards making security-core not tied to the password concept.

For upgrading, applications will have to use `passwords_hashers` instead of `encoders` in their security configuration,  and type-hint against `PasswordHasherInterface` (and related) instead of `PasswordEncoderInterface`.

The proposed API is not much different from the encoder one regarding behavior and signatures, and it is slightly more close to the PHP built-in password hashing API:

```php
namespace Symfony\Component\PasswordHasher;

interface PasswordHasherInterface
{
    public function hash(string $plainPassword): string;

    public function verify(string $hashedPassword, string $plainPassword): bool;

    public function needsRehash(string $hashedPassword): bool;
}
```

Commits
-------

c5c981c559 [Security] Extract password hashing from security-core - using the right naming
2021-02-12 16:53:00 +01:00
Robin Chalas
c5c981c559 [Security] Extract password hashing from security-core - using the right naming 2021-02-12 16:42:42 +01:00
carlos-ea
2248af5857 [HttpFoundation] Fix typo in exception message 2021-02-12 16:32:37 +01:00
Christian Flothmann
4a2c996b95 mark the LazyIterator class as internal 2021-02-12 11:48:09 +01:00
Christian Flothmann
fe4e2956e3 Merge branch '5.2' into 5.x
* 5.2:
  add missing return type declaration
  Modernize func_get_args() calls to variadic parameters
  Use a lazyintertor to close files descriptors when no longer used
2021-02-12 11:47:00 +01:00
Christian Flothmann
6dce3227db Merge branch '4.4' into 5.2
* 4.4:
  add missing return type declaration
  Modernize func_get_args() calls to variadic parameters
  Use a lazyintertor to close files descriptors when no longer used
2021-02-12 11:38:38 +01:00
Christian Flothmann
be6432ee4c fix extracting mixed type-hinted property types 2021-02-12 11:37:03 +01:00
Christian Flothmann
cfce9cbd59 add missing return type declaration 2021-02-12 11:28:39 +01:00
Fabien Potencier
dc20a31179 bug #40040 [Finder] Use a lazyIterator to close files descriptors when no longer used (jderusse)
This PR was merged into the 4.4 branch.

Discussion
----------

[Finder] Use a lazyIterator to close files descriptors when no longer used

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

The `RecursiveDirectoryIterator` class open the file on `__construct`.
Because we Inject an instance of `RecursiveDirectoryIterator` inside the \AppendIterator` class, php opens a lot of file even before iterating on it.

This PR adds a new `LazyIterator` class that instantiate the decorated class only when something starts iterating on it.
When the iteration is over, it unset the variable to close let the decorated class clean things (ie. close the files)

Commits
-------

7117e1a798 Use a lazyintertor to close files descriptors when no longer used
2021-02-12 08:28:15 +01:00
Alexander M. Turek
9323f413cb Merge branch '5.2' into 5.x
* 5.2:
  [Contracts] fix branch-aliases
  Fix transient test
2021-02-12 01:05:48 +01:00
Jérôme TAMARELLE
6217ff7b6f [Asset] Add tag assets.package to register asset packages
Autoconfiguration with PackageInterface
2021-02-11 23:08:21 +01:00
Alexander M. Turek
f2f880ac2c feature #40143 [Filesystem] improve messages on failure (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Filesystem] improve messages on failure

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

Commits
-------

f5ddfadcb2 [Filesystem] improve messages on failure
2021-02-11 20:49:37 +01:00
Alexander M. Turek
1f067bc4f7 bug #40114 [HttpFoundation] Fix consistency in sessions not found exceptions (jderusse)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[HttpFoundation] Fix consistency in sessions not found exceptions

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

Make `Request::getSession` thrown a `SessionNotFoundException` and make `SessionNotFoundException` extends `\BadMethodCallException` for backward compatibility and

Commits
-------

7fcb76d367 Fix consistency in sessions not found exceptions
2021-02-11 20:46:04 +01:00