Commit Graph

39135 Commits

Author SHA1 Message Date
Nicolas Grekas
e0d1e34ec7 minor #35918 Add Spanish translation (przemyslaw-bogusz)
This PR was merged into the 3.4 branch.

Discussion
----------

Add Spanish translation

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

@javiereguiluz I know it's not very significant, but in order to make distinction between `must be` and `should be`, shouldn't translation no. 94 be changed to `Este valor debería estar entre...`?

Commits
-------

9e67b57baa Add Spanish translation
2020-03-02 10:37:48 +01:00
Przemysław Bogusz
9e67b57baa Add Spanish translation 2020-03-02 10:37:39 +01:00
Fabien Potencier
6cb49b5e0c Fix typo 2020-03-02 09:43:43 +01:00
arai
af738c0c8f [Validator] add Japanese translation 2020-03-02 09:43:23 +01:00
Fabien Potencier
44ba43d673 Fix typo 2020-03-02 09:42:21 +01:00
Przemysław Bogusz
8c498ee487 Add Polish translation 2020-03-01 22:11:17 +01:00
Christian Flothmann
b01a10c760 prevent deprecation being triggered from assertion 2020-03-01 20:15:08 +01:00
Jules Pietri
1bd779d7c8
[SecurityBundle] Minor fixes in configuration tree builder 2020-02-29 22:44:21 +01:00
Fabien Potencier
b04484c3cf bumped Symfony version to 5.0.6 2020-02-29 13:30:49 +01:00
Fabien Potencier
9e1fab60f5 updated VERSION for 5.0.5 2020-02-29 11:41:30 +01:00
Fabien Potencier
2bd76fa32c bumped Symfony version to 4.4.6 2020-02-29 11:35:30 +01:00
Fabien Potencier
6c52d481e7 updated VERSION for 4.4.5 2020-02-29 11:31:38 +01:00
Fabien Potencier
8d2990e636 bumped Symfony version to 3.4.39 2020-02-29 11:30:13 +01:00
Fabien Potencier
dfc775c590 updated VERSION for 3.4.38 2020-02-29 11:16:41 +01:00
Fabien Potencier
6429999e91 Merge branch '5.0'
* 5.0:
  [Dotenv] Documentation improvement
  [DI] Clarified deprecation for TypedReference in 4.4
  [Validator] Add missing vietnamese translations
  add German translation
  add missing Messenger options to XML schema definition
  [5.0] Remove some unused variables
  [Validator][ConstraintValidator] Update wrong PRETTY_DATE doc
  [DomCrawler][Form] Fix PHPDoc on get & offsetGet
  [ErrorHandler] fix parsing static return type on interface method annotation (fix #35836)
  prevent method calls on null values
  Return int if scale = 0
2020-02-29 11:07:16 +01:00
Fabien Potencier
65d06cbd41 Merge branch '4.4' into 5.0
* 4.4:
  [Dotenv] Documentation improvement
  [DI] Clarified deprecation for TypedReference in 4.4
  [Validator] Add missing vietnamese translations
  add German translation
  add missing Messenger options to XML schema definition
  [Validator][ConstraintValidator] Update wrong PRETTY_DATE doc
  [DomCrawler][Form] Fix PHPDoc on get & offsetGet
  [ErrorHandler] fix parsing static return type on interface method annotation (fix #35836)
  prevent method calls on null values
  Return int if scale = 0
2020-02-29 11:07:09 +01:00
Fabien Potencier
8f7b8aa41d Merge branch '3.4' into 4.4
* 3.4:
  [Validator] Add missing vietnamese translations
  add German translation
  [Validator][ConstraintValidator] Update wrong PRETTY_DATE doc
  [DomCrawler][Form] Fix PHPDoc on get & offsetGet
  prevent method calls on null values
  Return int if scale = 0
2020-02-29 11:05:28 +01:00
jonmldr
4f61247ccc [Dotenv] Documentation improvement 2020-02-29 11:04:02 +01:00
Fabien Potencier
0888ff6dbd minor #35894 [ExpressionLanguage] Fixed exception message (atailouloute)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[ExpressionLanguage] Fixed exception message

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

Commits
-------

4d695b380d [ExpressionLanguage] Fixed exception message
2020-02-29 11:02:13 +01:00
Fabien Potencier
34c2e96b08 bug #35781 [Form] NumberToLocalizedStringTransformer return int if scale = 0 (VincentLanglet)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] NumberToLocalizedStringTransformer return int if scale = 0

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35775
| License       | MIT
<!--
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 master.
-->

Commits
-------

2993fc9fc5 Return int if scale = 0
2020-02-29 10:59:06 +01:00
Fabien Potencier
146945ad8e feature #35782 [Routing] Add stateless route attribute (mtarld)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Routing] Add stateless route attribute

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Ticket		| https://github.com/orgs/symfony/projects/1#card-30506005
| License       | MIT
| Doc PR        | TODO

On top of https://github.com/symfony/symfony/pull/35732

Add a stateless attribute for:
Routes in annotations
```
@Route(stateless=true)
```
Yaml
```yml
route:
  stateless: true
```
Xml
```xml
<route stateless="true" />
```
PHP configurator
```php
$route->stateless(true);
```

That stateless attribute is a shortcut for setting `_stateless` default attribute in route.

Commits
-------

2da68bae8f [Routing] Add stateless route attribute
2020-02-29 10:56:15 +01:00
Fabien Potencier
7295d25f32 bug #35846 [Serializer] prevent method calls on null values (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Serializer] prevent method calls on null values

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

Commits
-------

847d6dc8f3 prevent method calls on null values
2020-02-29 10:53:07 +01:00
Fabien Potencier
dc9a0b586f bug #35897 [FrameworkBundle] add missing Messenger options to XML schema definition (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] add missing Messenger options to XML schema definition

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix symfony/symfony-docs#13010
| License       | MIT
| Doc PR        | symfony/symfony-docs#13277

Commits
-------

45a033d67b add missing Messenger options to XML schema definition
2020-02-29 10:50:54 +01:00
Fabien Potencier
8ed2e66de4 minor #35898 [DI] Clarified deprecation for TypedReference in 4.4 (linaori)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[DI] Clarified deprecation for TypedReference in 4.4

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| 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 #35752 <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        |~ <!-- required for new features -->

Changes the deprecation message to indicate the argument has been removed and how to fix it.

Commits
-------

1c70048e9c [DI] Clarified deprecation for TypedReference in 4.4
2020-02-29 10:50:10 +01:00
Lynn
1c70048e9c [DI] Clarified deprecation for TypedReference in 4.4 2020-02-29 10:50:04 +01:00
Fabien Potencier
6c042661e2 minor #35901 [Validator] add German translation (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] add German translation

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

Commits
-------

9d837ecb34 add German translation
2020-02-29 10:08:42 +01:00
Jan Schädlich
c16d153522 [Validator] Add missing vietnamese translations 2020-02-29 09:57:15 +01:00
arai
90104a919d [Validator] add Japanese translation 2020-02-29 09:37:39 +09:00
Christian Flothmann
9d837ecb34 add German translation 2020-02-28 15:30:03 +01:00
Christian Flothmann
45a033d67b add missing Messenger options to XML schema definition 2020-02-28 14:15:16 +01:00
Ahmed TAILOULOUTE
4d695b380d [ExpressionLanguage] Fixed exception message 2020-02-28 11:19:56 +01:00
Nicolas Grekas
5ffb96452f minor #35861 [DomCrawler][Form] Fix PHPDoc on get & offsetGet (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[DomCrawler][Form] Fix PHPDoc on get & offsetGet

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

`FormFieldRegistry::get()` returns mixed. For example, it can return an array when the field is a collection.

Commits
-------

f8735cc47b [DomCrawler][Form] Fix PHPDoc on get & offsetGet
2020-02-27 11:19:42 +01:00
Jérémy Derussé
03b7743ff5
Optimize HttpClient when body is iterable 2020-02-27 00:20:25 +01:00
Thomas Calvet
1f953e42f2 [5.0] Remove some unused variables 2020-02-26 23:30:10 +01:00
Thomas Calvet
491fc5c24d [Validator][ConstraintValidator] Update wrong PRETTY_DATE doc 2020-02-26 21:34:36 +01:00
Thomas Calvet
f8735cc47b [DomCrawler][Form] Fix PHPDoc on get & offsetGet 2020-02-26 18:12:32 +01:00
Mathias Arlaud
2da68bae8f [Routing] Add stateless route attribute 2020-02-26 15:20:07 +01:00
Alessandro Chitolina
55734a297f
[ErrorHandler] fix parsing static return type on interface method annotation (fix #35836) 2020-02-26 12:45:31 +01:00
Fabien Potencier
7995fed10b feature #35732 [FrameworkBundle][HttpKernel] Add session usage reporting in stateless mode (mtarld)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle][HttpKernel] Add session usage reporting in stateless mode

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

https://github.com/orgs/symfony/projects/1#card-30506005

Provide a `@Stateless` annotation that forbid session usage for annotated controllers (or classes).

## Implementations
**v1**
- ~~New session proxy that allows session to be marked as disabled~~
- ~~New default route attribute: `_stateless` (automatically set by `@Stateless`)~~
- ~~On kernel controller event, if `_stateless` is `true`, session is marked as disabled~~
- ~~Session listener is able to check if the session is disabled and prevent its creation~~

**v2**
- New default route attribute: `_stateless` (automatically set by `@Stateless`)
- On kernel response, check the session usage and if session was used when `_stateless` attribute is set to `true`: Either throw an exception (debug enabled) or log a warning (debug disabled)

Commits
-------

bc48db2424 [FrameworkBundle][HttpFoundation] Add `_stateless`
2020-02-26 11:40:28 +01:00
Robin Chalas
dca77c42ec Merge branch '5.0'
* 5.0:
  [Security] Allow switching to another user when already switched
2020-02-26 11:32:20 +01:00
Robin Chalas
4206b4dc4a Merge branch '4.4' into 5.0
* 4.4:
  [Security] Allow switching to another user when already switched
2020-02-26 11:31:10 +01:00
Robin Chalas
3057c68b93 Merge branch '3.4' into 4.4
* 3.4:
  [Security] Allow switching to another user when already switched
2020-02-26 11:27:30 +01:00
Mathias Arlaud
bc48db2424 [FrameworkBundle][HttpFoundation] Add _stateless 2020-02-26 11:16:11 +01:00
Robin Chalas
0353077083 [Security] Allow switching to another user when already switched 2020-02-26 04:23:24 +01:00
Nicolas Grekas
d0e5593b1f Merge branch '5.0'
* 5.0:
  [FrameworkBundle] Fix test
2020-02-25 15:44:02 +01:00
Nicolas Grekas
cd355dff07 Merge branch '4.4' into 5.0
* 4.4:
  [FrameworkBundle] Fix test
2020-02-25 15:39:06 +01:00
Nicolas Grekas
1b377a86db Merge branch '3.4' into 4.4
* 3.4:
  [FrameworkBundle] Fix test
2020-02-25 15:33:04 +01:00
Nicolas Grekas
159ef1bf1d [FrameworkBundle] Fix test 2020-02-25 15:31:47 +01:00
Nicolas Grekas
c56cf2da5d Merge branch '5.0'
* 5.0:
  minor #35833 [FrameworkBundle] Add missing items in the unused tag pass whitelist (fabpot)
  [HttpClient][DX] Add URL context to JsonException messages
  [Routing] Improve localized routes performances
  [4.4][DoctrineBridge] Use new Types::* constants and support new json type
  [Validator] Add missing translations
  [Notifier] Dispatch message event in null transport
  [Messenger] Use Doctrine DBAL new Types::* constants
2020-02-25 15:29:12 +01:00
Nicolas Grekas
11097a5aa6 Merge branch '4.4' into 5.0
* 4.4:
  minor #35833 [FrameworkBundle] Add missing items in the unused tag pass whitelist (fabpot)
  [HttpClient][DX] Add URL context to JsonException messages
  [Routing] Improve localized routes performances
  [4.4][DoctrineBridge] Use new Types::* constants and support new json type
  [Validator] Add missing translations
  [Messenger] Use Doctrine DBAL new Types::* constants
2020-02-25 15:24:11 +01:00
Nicolas Grekas
1107548146 Merge branch '3.4' into 4.4
* 3.4:
  minor #35833 [FrameworkBundle] Add missing items in the unused tag pass whitelist (fabpot)
  [Validator] Add missing translations
2020-02-25 15:19:32 +01:00
Nicolas Grekas
b515bc9a97 minor #35833 [FrameworkBundle] Add missing items in the unused tag pass whitelist (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Add missing items in the unused tag pass whitelist

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

We have some missing tags in the whitelist. I've added a script that adds the missing ones, and added a test to avoid forgetting about updating the whitelist.

Commits
-------

d1bcc0fc5e [FrameworkBundle] Add a script that checks for missing items in the unused tag whitelist
2020-02-25 15:18:39 +01:00
Nicolas Grekas
cad3f10cdb minor #35822 [HttpClient][DX] Add URL context to JsonException messages (GromNaN)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[HttpClient][DX] Add URL context to JsonException messages

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/pull/35762#issuecomment-589770016
| License       | MIT
| Doc PR        | N/A

In order to help when debugging incorrect JSON responses, this PR adds the requested URL to the error message.

Before: `Syntax Error`
After: `JSON error: Syntax error, from "https://example.com/file.json".`
See the 2nd commit for full diff in new unit tests

Commits
-------

06539173e7 [HttpClient][DX] Add URL context to JsonException messages
2020-02-25 14:55:46 +01:00
Jérôme TAMARELLE
06539173e7 [HttpClient][DX] Add URL context to JsonException messages 2020-02-25 14:55:11 +01:00
Nicolas Grekas
7b89d1b004 feature #35815 [Validator] Allow Sequentially constraints on classes + target guards (ogizanagi)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Validator] Allow Sequentially constraints on classes + target guards

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | N/A <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | todo in https://github.com/symfony/symfony-docs/pull/13206 if not merged yet

There is no reason to limit this constraint to properties, so let's add classes as targets.

Additionally, let's ensure embedded constraints matches allowed targets too.

Commits
-------

1e02a96286 [Validator] Allow Sequentially constraints on classes
2020-02-25 14:41:21 +01:00
Nicolas Grekas
d297231c56 minor #35833 [FrameworkBundle] Add missing items in the unused tag pass whitelist (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Add missing items in the unused tag pass whitelist

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

We have some missing tags in the whitelist. I've added a script that adds the missing ones, and added a test to avoid forgetting about updating the whitelist.

Commits
-------

d1bcc0fc5e [FrameworkBundle] Add a script that checks for missing items in the unused tag whitelist
2020-02-25 14:09:27 +01:00
Fabien Potencier
d1bcc0fc5e [FrameworkBundle] Add a script that checks for missing items in the unused tag whitelist 2020-02-25 14:08:07 +01:00
Fabien Potencier
8a678f6679 minor #35819 [Messenger] Use Doctrine DBAL new Types::* constants (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger] Use Doctrine DBAL new Types::* constants

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

Commits
-------

f1fb1597ff [Messenger] Use Doctrine DBAL new Types::* constants
2020-02-25 14:05:06 +01:00
Ahmed TAILOULOUTE
b5744601bf [Routing][FrameworkBundle] Allow using env() in route conditions 2020-02-25 14:01:02 +01:00
Fabien Potencier
8867f57a44 feature #35857 [Routing] deprecate RouteCompiler::REGEX_DELIMITER (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Routing] deprecate RouteCompiler::REGEX_DELIMITER

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

This should be mostly internal cleanup.

Commits
-------

21b8a64446 [Routing] deprecate RouteCompiler::REGEX_DELIMITER
2020-02-25 13:53:07 +01:00
Fabien Potencier
28a249f2e5 feature #35804 [HttpFoundation] Added MarshallingSessionHandler (atailouloute)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpFoundation] Added MarshallingSessionHandler

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

Added `MarshallingSessionHandler`, a decorator for session handlers which uses the cache marshaller in order to encrypt session data.

(This is an alternative solution to #35643)

To use it, we can simply decorate the session marshaller, after that all session data will be encrypted

```yaml
Symfony\Component\Cache\Marshaller\SodiumMarshaller:
    decorates: 'session.marshaller'
    arguments:
        - ['%env(file:resolve:SODIUM_DECRYPTION_FILE)%']
        - '@Symfony\Component\Cache\Marshaller\SodiumMarshaller.inner'
```

TODO:
- [x] unit tests

Commits
-------

155d980aea [HttpFoundation][Cache] Added MarshallingSessionHandler
2020-02-25 13:51:34 +01:00
Fabien Potencier
82db995908 feature #35858 [Security] Deprecated ROLE_PREVIOUS_ADMIN (wouterj)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Security] Deprecated ROLE_PREVIOUS_ADMIN

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Tickets       | n/a
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/11487

`ROLE_PREVIOUS_ADMIN` is added to the token roles if the session is an impersonation. Since https://github.com/symfony/symfony/pull/31189 we have the `IS_IMPERSONATOR` attribute which can be used for the same reason. I propose to deprecate the `ROLE_PREVIOUS_ADMIN`:

* This is not what roles are for ([resulting in hacking this exception in `AbstractToken`](https://github.com/symfony/symfony/blob/5.0/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php#L275-L277))
* The role isn't very descriptive
* I don't like having 2 ways of doing exactly the same thing
* While every application with impersonation enabled probably needs to be updated, the update is as simple as replacing `ROLE_PREVIOUS_ADMIN` with `IS_IMPERSONATOR`: `find ./ -type f -exec sed -i 's/ROLE_PREVIOUS_ADMIN/IS_IMPERSONATOR/g' {} +`

---

I'm a bit unsure on how to deprecate this role, but I think having it in `RoleVoter` is probably the safest (`isGranted()` and variants + `AccessDecisionManager#decide()` all use this voter to check if the token has this role).

Commits
-------

dce55f352a Deprecated ROLE_PREVIOUS_ADMIN
2020-02-25 13:48:58 +01:00
Nicolas Grekas
ef95f2ecbc minor #35855 [Routing] Improve localized routes performances (mtarld)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing] Improve localized routes performances

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| License       | MIT

Implementation of the following idea: https://github.com/symfony/symfony/pull/35735#pullrequestreview-360525593

Improve route matching performances by turning dynamic routes with fixed `_locale` to actual static routes.

Commits
-------

8e9eafe18b [Routing] Improve localized routes performances
2020-02-25 13:47:10 +01:00
Mathias Arlaud
8e9eafe18b [Routing] Improve localized routes performances 2020-02-25 13:41:09 +01:00
Wouter de Jong
dce55f352a Deprecated ROLE_PREVIOUS_ADMIN 2020-02-25 13:38:33 +01:00
Wouter J
3f0c599289 Use new IS_* attributes in the expression language functions 2020-02-25 12:47:18 +01:00
Nicolas Grekas
21b8a64446 [Routing] deprecate RouteCompiler::REGEX_DELIMITER 2020-02-25 11:55:47 +01:00
Thomas Calvet
ddf33535d0 [4.4][DoctrineBridge] Use new Types::* constants and support new json type 2020-02-24 18:16:47 +01:00
Fabien Potencier
d7250ef620 [Validator] Add missing translations 2020-02-24 18:16:32 +01:00
Fabien Potencier
8b819ba442 bug #35841 [Notifier] Dispatch message event in null transport (jschaedl)
This PR was squashed before being merged into the 5.0 branch.

Discussion
----------

[Notifier] Dispatch message event in null transport

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| 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 #", if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

I think we should be able to log notifications via the `NotificationLoggerListener` even if they were sent to a null transport. The mailer component does it the same way.

Commits
-------

a0d99ce398 [Notifier] Dispatch message event in null transport
2020-02-24 18:03:22 +01:00
Jan Schädlich
a0d99ce398 [Notifier] Dispatch message event in null transport 2020-02-24 18:03:13 +01:00
Fabien Potencier
b5e6582398 feature #35848 [Validator] add alpha3 option to Language constraint (xabbuh)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Validator] add alpha3 option to Language constraint

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix https://github.com/symfony/symfony/pull/35116#issuecomment-570038901
| License       | MIT
| Doc PR        |

Commits
-------

ce73b98e2c add alpha3 option to Language constraint
2020-02-24 17:28:00 +01:00
Fabien Potencier
6178c63148 feature #31189 [Security] Add IS_IMPERSONATOR, IS_ANONYMOUS and IS_REMEMBERED (HeahDude)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Security] Add IS_IMPERSONATOR, IS_ANONYMOUS and IS_REMEMBERED

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/29848
| License       | MIT
| Doc PR        | symfony/symfony-docs#11487

This continues work of @HeahDude and finally finishes one of the code PRs I've been working on during the ️ EUFOSSA Hackathon.

Changes
---

The PRs modifies some of the attributes used by the `AuthenticatedVoter`:

* New `IS_IMPERSONATOR`, `IS_ANONYMOUS` and `IS_REMEMBERED` attributes are introduced to indicate the user either impersonated, anonymous or rembered.
* <s>`IS_AUTHENTICATED_ANONYMOUSLY` actually meant "is authenticated, either anonymous or fully". As this is confusing, it is replaced by `IS_AUTHENTICATED`.</s>
* <s>All `is_*()` functions in expressions are deprecated in favor of `is_granted('IS_*')`. It's not worth duplicating the `AuthenticatedVoter` logic in two places now we have shorter `IS_*` attributes</s>

**Before**

```php
if ($authorizationChecker->isGranted('ROLE_PREVIOUS_ADMIN')) {
    // ...
}
```
<s>

```yaml
security:
  # ...

  access_control:
    - { path: ^/protected, roles: 'IS_AUTHENTICATED_ANONYMOUSLY' }
```
</s>

**After**

```php
if ($authorizationChecker->isGranted('IS_IMPERSONATOR')) {
    // ...
}
```
<s>

```yaml
security:
  # ...

  access_control:
    - { path: ^/protected, roles: 'IS_AUTHENTICATED' }
```
</s>

<s>Discussion
---

The only thing I'm wondering is how we combine this with the `is_authenticated()` expression function:

98929dc292/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguageProvider.php (L33-L37)

As you can see, the `IS_AUTHENTICATED` attribute and `is_authenticated()` expression function do not have the same meaning. Should we somehow deprecate the current behavior of `is_authenticated()` or should we find another name for `IS_AUTHENTICATED` (that would be a shame imo).</s>

Commits
-------

6c522a7d98 Added IS_ANONYMOUS, IS_REMEMBERED, IS_IMPERSONATOR
2020-02-24 17:01:02 +01:00
Nicolas Grekas
c231214e59 Merge branch '5.0'
* 5.0: (28 commits)
  [DoctrineBridge] Use new Types::* constants and support new json type
  Fix bad merge in README of Nexmo Notifier bridge
  [Debug][ErrorHandler] improved deprecation notices for methods new args and return type
  [BrowserKit] Nested file array prevents uploading file
  [ExpressionLanguage] Fixed collisions of character operators with object properties
  remove usage of already deleted Symfony\Component\EventDispatcher\Event
  [Notifier] Add correct tags for NullTransportFactory
  [Validator] Remove specific check for Valid targets
  [PhpUnitBridge] Use trait instead of extending deprecated class
  Fix versioned namespace clears
  fix remember me
  Use strict assertion in asset tests
  [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types
  Do not rely on the current locale when dumping a Graphviz object
  fix typo
  [Ldap] force default network timeout
  [Config] don't throw on missing excluded paths
  Docs: Typo, grammar
  [Validator] Add the missing translations for the Polish ("pl") locale
  [PhpUnitBridge] Add compatibility to PHPUnit 9 #35662
  ...
2020-02-24 16:14:17 +01:00
Nicolas Grekas
08a233bc6d Merge branch '4.4' into 5.0
* 4.4: (25 commits)
  [DoctrineBridge] Use new Types::* constants and support new json type
  [Debug][ErrorHandler] improved deprecation notices for methods new args and return type
  [BrowserKit] Nested file array prevents uploading file
  [ExpressionLanguage] Fixed collisions of character operators with object properties
  [Validator] Remove specific check for Valid targets
  [PhpUnitBridge] Use trait instead of extending deprecated class
  Fix versioned namespace clears
  fix remember me
  Use strict assertion in asset tests
  [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types
  Do not rely on the current locale when dumping a Graphviz object
  fix typo
  [Ldap] force default network timeout
  [Config] don't throw on missing excluded paths
  Docs: Typo, grammar
  [Validator] Add the missing translations for the Polish ("pl") locale
  [PhpUnitBridge] Add compatibility to PHPUnit 9 #35662
  [Routing] Add locale requirement for localized routes
  [Console] Inline exact-match handling with 4.4
  Set previous exception when rethrown from controller resolver
  ...
2020-02-24 16:05:31 +01:00
Nicolas Grekas
1024f5fc10 bug #35716 [PhpUnitBridge] Fix compatibility to PHPUnit 9 (Benjamin)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Fix compatibility to PHPUnit 9

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

Adding the possibility to use PHPUnit 9.

Commits
-------

771c642a43 [PhpUnitBridge] Add compatibility to PHPUnit 9 #35662
2020-02-24 15:58:55 +01:00
Nicolas Grekas
c0caef1708 bug #35803 [Cache] Fix versioned namespace atomic clears (trvrnrth)
This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] Fix versioned namespace atomic clears

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

When using namespace versioning to achieve atomic cache clears, only delete cache keys matching the old/current version.

This resolves tag inconsistency issues whereby the process running the clear would delete keys set against the new version by more recently spawned concurrent processes. Most seriously this could result in newly set data keys remaining, but with empty associated tag sets meaning the invalidation via tags was no longer possible.

Clearing specific prefixes is not supported when using versioned namespaces as it is desirable to clear all old keys as they will no longer be used and would otherwise eventually fill cache memory.

Commits
-------

971b177d27 Fix versioned namespace clears
2020-02-24 15:49:35 +01:00
Christian Flothmann
ce73b98e2c add alpha3 option to Language constraint 2020-02-24 15:47:52 +01:00
Christian Flothmann
847d6dc8f3 prevent method calls on null values 2020-02-24 15:33:45 +01:00
Nicolas Grekas
2d53ff64c9 Merge branch '3.4' into 4.4
* 3.4:
  [DoctrineBridge] Use new Types::* constants and support new json type
2020-02-24 15:14:40 +01:00
Nicolas Grekas
9819814a8a bug #35817 [3.4][DoctrineBridge] Use new Types::* constants and support new json type (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[3.4][DoctrineBridge] Use new Types::* constants and support new json type

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

All `Type::*` constants were moved and deprecated. This PR makes sure we use the good ones when they exist so we are prepared for their removal. It allows to be deprecation free. If deprecated constants could be detected, we would have failing tests 😄

Also, `json_array` was deprecated and renamed to `json`, so I added support for this new type.

Some new components also use these constants on upper branches, so I will submit PRs there.

Commits
-------

3e35fa59ea [DoctrineBridge] Use new Types::* constants and support new json type
2020-02-24 14:39:45 +01:00
Fabien Potencier
f4332cb109 Merge branch '5.0'
* 5.0:
  [FrameworkBundle] Skip notifiers tags in UnusedTagsPass
  [Notifier] Remove not needed argument $bus in BrowserChannel::notify()
2020-02-24 14:39:20 +01:00
Thomas Calvet
f1fb1597ff [Messenger] Use Doctrine DBAL new Types::* constants 2020-02-24 14:12:43 +01:00
Thomas Calvet
3e35fa59ea [DoctrineBridge] Use new Types::* constants and support new json type 2020-02-24 14:11:05 +01:00
Fabien Potencier
a67abe1fb6 Merge branch '3.4' into 4.4
* 3.4:
  [ExpressionLanguage] Fixed collisions of character operators with object properties
  [Validator] Remove specific check for Valid targets
  [PhpUnitBridge] Use trait instead of extending deprecated class
  fix remember me
  Use strict assertion in asset tests
  [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types
  Do not rely on the current locale when dumping a Graphviz object
  fix typo
  [Ldap] force default network timeout
  [Config] don't throw on missing excluded paths
  Docs: Typo, grammar
  [Validator] Add the missing translations for the Polish ("pl") locale
  [Console] Inline exact-match handling with 4.4
  Set previous exception when rethrown from controller resolver
  [VarDumper] fixed DateCaster not displaying additional fields
  [HttpKernel] fix registering DebugHandlersListener regardless of the PHP_SAPI
2020-02-24 14:10:00 +01:00
Nicolas Grekas
da28445ea4 bug #35832 [Debug][ErrorHandler] improved deprecation notices for methods new args and return type (HeahDude)
This PR was merged into the 4.4 branch.

Discussion
----------

[Debug][ErrorHandler] improved deprecation notices for methods new args and return type

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

~I don't know if this should be considered a bug fix or a feature.~

Commits
-------

83d4aa7683 [Debug][ErrorHandler] improved deprecation notices for methods new args and return type
2020-02-24 10:54:50 +01:00
Nicolas Grekas
d29865ed79 minor #35835 Fix bad merge in README of Nexmo Notifier bridge (eXtreme)
This PR was merged into the 5.0 branch.

Discussion
----------

Fix bad merge in README of Nexmo Notifier bridge

| Q             | A
| ------------- | ---
| Branch?       |  5.0
| License       | MIT

[Bad merge](85f793bec6 (diff-ba05e8af79b613430b91ba4d4ccbea0d)) made b52b7b9fd6 end up in Nexmo README :)

Commits
-------

a8d0c5b1d7 Fix bad merge in README of Nexmo Notifier bridge
2020-02-24 10:52:43 +01:00
Ahmed TAILOULOUTE
155d980aea [HttpFoundation][Cache] Added MarshallingSessionHandler 2020-02-23 23:33:06 +01:00
Nicolas Grekas
f75be008bc minor #35816 [Validator] Remove specific check for Valid targets (ogizanagi)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Remove specific check for Valid targets

| Q             | A
| ------------- | ---
| Branch?       | 3.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       | N/A <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | N/A

As covered by `ClassMetadataTest::testAddConstraintDoesNotAcceptValid`, this check is useless, as `Valid` already accepts only properties as targets.

This check is a [leftover of a time](9b07b0c672) `Valid` was extending `Traverse` which was allowing classes & properties.
The `Valid` targets are properly checked by the lines above, the same way as other constraints.

Commits
-------

0086562c77 [Validator] Remove specific check for Valid targets
2020-02-23 22:17:02 +01:00
Nicolas Grekas
de15900c38 minor #35829 Remove usage of already deleted Symfony\Component\EventDispatcher\Event (W0rma)
This PR was merged into the 5.0 branch.

Discussion
----------

Remove usage of already deleted Symfony\Component\EventDispatcher\Event

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

Remove usage of already deleted class `Symfony\Component\EventDispatcher\Event`

Commits
-------

dedbc4d814 remove usage of already deleted Symfony\Component\EventDispatcher\Event
2020-02-23 22:15:05 +01:00
Jacek Jędrzejewski
a8d0c5b1d7
Fix bad merge in README of Nexmo Notifier bridge 2020-02-23 20:22:26 +01:00
Jules Pietri
83d4aa7683
[Debug][ErrorHandler] improved deprecation notices for methods new args and return type 2020-02-23 15:41:43 +01:00
Anna Filina
e15f05e03f [BrowserKit] Nested file array prevents uploading file 2020-02-23 11:00:59 +01:00
Nicolas Grekas
03f525ad52 bug #35826 [Notifier] Add correct tags for NullTransportFactory (jschaedl)
This PR was merged into the 5.0 branch.

Discussion
----------

[Notifier] Add correct tags for NullTransportFactory

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| 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 #", if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

I tried to disable the delivery of notifications in `dev` environment with the following configuration:

```
framework:
    notifier:
        chatter_transports:
            slack: 'null://null'
        texter_transports:
            twilio: 'null://null'
        channel_policy:
            urgent: ['chat/slack', 'sms/twilio']
            high: ['email']
            medium: ['email']
            low: ['email']
```

While sending the notification like this:

```
$notification = (new Notification())
            ->subject('Test subject')
            ->importance(Notification::IMPORTANCE_URGENT)
            ->content('Test content')
;

$this->notifier->send($notification);
```

I got an `UnsupportedSchemeException`: The "null" scheme is not supported.

After some digging I figured out that this Exception occurred because the `NullTransportFactory` was not tagged with the `chatter.transport_factory` and `texter.transport_factory` tags. Which is the reason the `NullTransportFactory` was not injected in the `Transport` class and so the `NullTransport` couldn't be used.

This PR should fix this Bug.

Commits
-------

1ff5e3c83f [Notifier] Add correct tags for NullTransportFactory
2020-02-23 10:40:24 +01:00
Nicolas Grekas
b3b368b800 minor #35808 [HttpFoundation] Fixed Mime dependency missing error (HeahDude)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpFoundation] Fixed Mime dependency missing error

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

Follows #35642, by adding a missing exception and a note in the UPGRADE file (CHANGELOG in HttpFoundation was already up to date).
Reported in symfony/symfony-docs#1307

Commits
-------

fef0de3eb6 [HttpFoundation] Fixed Mimes dependency missing error
2020-02-23 10:28:35 +01:00
Fabien Potencier
1676e3a317 bug #35707 [ExpressionLanguage] Fixed collisions of character operators with object properties (Andrej-in-ua)
This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[ExpressionLanguage] Fixed collisions of character operators with object properties

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

Expression `foo.not in [bar]` compiles to invalid php code:

```
$foo->not in[$bar]
```

Added check for absence of a dot before of the character operators.

PS. I apologize for not starting the issue before create PR. I considered this bug is minor, but obvious.

Commits
-------

4b83ae7547 [ExpressionLanguage] Fixed collisions of character operators with object properties
2020-02-23 09:43:32 +01:00
Andrey Sevastianov
4b83ae7547 [ExpressionLanguage] Fixed collisions of character operators with object properties 2020-02-23 09:43:25 +01:00
Robin Chalas
24cfb7f095 [FrameworkBundle] Skip notifiers tags in UnusedTagsPass 2020-02-23 06:45:13 +01:00
Dieter
dedbc4d814 remove usage of already deleted Symfony\Component\EventDispatcher\Event 2020-02-22 21:09:08 +01:00
Jules Pietri
6c522a7d98 Added IS_ANONYMOUS, IS_REMEMBERED, IS_IMPERSONATOR 2020-02-22 18:11:06 +01:00
Vincent Langlet
2993fc9fc5 Return int if scale = 0 2020-02-22 14:29:03 +01:00
Jan Schädlich
1ff5e3c83f [Notifier] Add correct tags for NullTransportFactory 2020-02-22 13:45:28 +01:00
Maxime Steinhausser
0086562c77 [Validator] Remove specific check for Valid targets 2020-02-21 16:29:16 +01:00
Maxime Steinhausser
1e02a96286 [Validator] Allow Sequentially constraints on classes 2020-02-21 15:09:54 +01:00
Fabien Potencier
643f34ff59 bug #35794 [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/35542 and https://github.com/symfony/symfony/issues/35604
| License       | MIT
| Doc PR        | -

For https://github.com/symfony/symfony/issues/35604:
To guess the collection key type, the `getPhpType()` method is called. But it does not handle most objects and arrays core types. This is why an indexBy datetime does not work.

For https://github.com/symfony/symfony/issues/35542:
When the php type cannot be guessed, null is returned. In this case, we cannot pass a valid builtin type to PropertyInfo Type, so we should return null.

Commits
-------

018ec1ae5c [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types
2020-02-21 09:07:04 +01:00
Fabien Potencier
8197d9a69e bug #35787 [PhpUnitBridge] Use trait instead of extending deprecated class (marcello-moenkemeyer)
This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[PhpUnitBridge] Use trait instead of extending deprecated class

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

Use `TestListenerDefaultImplementation` instead of deprecated `BaseTestListener` for `CoverageListenerForV6`

As this is my very first pull request for this project, I'd be very glad for hints and suggestions in case I missed something.

Commits
-------

034e1de6e6 [PhpUnitBridge] Use trait instead of extending deprecated class
2020-02-21 09:01:59 +01:00
Marcello Mönkemeyer
034e1de6e6 [PhpUnitBridge] Use trait instead of extending deprecated class 2020-02-21 09:01:47 +01:00
Fabien Potencier
269c4a2e15 feature #30994 [Form] Added support for caching choice lists based on options (HeahDude)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Form] Added support for caching choice lists based on options

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | symfony/symfony-docs#13182

Currently, the `CachingFactoryDecorator` is responsible for unnecessary memory usage, anytime a choice option is set with a callback option defined as an anonymous function or a loader, then a new hash is generated for the choice list, while we may expect the list to be reused once "finally" configured in a form type or choice type extension.

A simple case is when using one of the core intl choice types in a collection:
```php
// ...
class SomeFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('some_choices', ChoiceType::class, [
                // before: cached choice list (unnecessary overhead)
                // after: no cache (better perf)
                'choices' => $someObjects,
                'choice_value' => function (?object $choice) { /* return some string */ },
            ])

            // see below the nested effects
            ->add('nested_fields', CollectionType::class, [
                'entry_type' => NestedFormType::class,
            ])
    // ...
}

// ...
class NestedFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            // ...
            ->add('some_other_choices', ChoiceType::class, [
                // before: cached choice list for every entry because we define a new closure instance for each field
                // after: no cache, a bit better for the same result, but much better if it were not nested in a collection
                'choices' => $someOtherObjects,
                'choice_value' => function (?object $otherChoice) { /* return some string */ },
            ])

            ->add('some_loaded_choices', ChoiceType::class, [
                // before: cached but for every entry since every field will have its
                //         own instance of loader, generating a new hash
                // after: no cache, same pro/cons as above
                'choice_loader' => new CallbackChoiceLoader(function() { /* return some choices */}),
                // or
                'choice_loader' => new SomeLoader(),
            ])

            ->add('person', EntityType::class, [
                // before: cached but for every entry, because we define extra `choice_*` option
                // after: no cache, same pro/cons as above
                'class' => SomeEntity::class,
                'choice_label' => function (?SomeEntity $choice) { /* return some label */},
            ])

            // before: cached for every entry, because the type define some "choice_*" option
            // after: cached only once, better perf since the same loader is used for every entry
            ->add('country', CountryType::class)

            // before: cached for every entry, because the type define some "choice_*" option
            // after: no cache, same pro/cons as above
            ->add('locale', LocaleType::class, [
                'preferred_choices' => [ /* some preferred locales */ ],
                'group_by' => function (?string $locale, $label) { /* return some group */ },
            ])
// ...
```

In such cases, we would expect every entries to use the same cached intl choice list, but not, as many list and views as entries will be kept in cache. This is even worse if some callback options like `choice_label`, `choice_value`, `choice_attr`, `choice_name`, `preferred_choices` or `group_by` are used.
This PR helps making cache explicit when needed and ~deprecate~ drop unexpected implicit caching of choice list for most simple cases responsible of unnecessary overhead.

The result is better performance just by upgrading to 5.1 \o/.
But to solve the cases above when cache is needed per options, one should now use the new `ChoiceList` static methods to wrap option values, which is already done internally in this PR.

```php
use Symfony\Component\Form\ChoiceList\ChoiceList;
// ...
class NestedFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            // explicitly shared cached choice lists between entries

            ->add('some_other_choices', ChoiceType::class, [
                'choices' => $someOtherObjects,
                'choice_value' => ChoiceList::value($this, function (?object $otherChoice) {
                    /* return some string */
                }),
            ]),

            ->add('some_loaded_choices', ChoiceType::class, [
                'choice_loader' => ChoiceList::lazy($this, function() {
                    /* return some choices */
                })),
                // or
                'choice_loader' => ChoiceList::loader($this, new SomeLoader()),
            ]),

            ->add('person', EntityType::class, [
                'class' => SomeEntity::class,
                'choice_label' => ChoiceList::label($this, function (?SomeEntity $choice) {
                    /* return some label */
                },
            ])

            // nothing to do :)
            ->add('country', CountryType::class)

            ->add('locale', LocaleType::class, [
                'preferred_choices' => ChoiceList::preferred($this, [ /* some preferred locales */ ]),
                'group_by' => ChoiceList::groupBy($this, function (?string $locale, $label) {
                    /* return some group */
                }),
            ])
// ...
```

I've done some nice profiling with Blackfire and the simple example above in a fresh website skeleton and only two empty entries as initial data, then submitting an empty form. That gives the following results:

 * Rendering the form - Before vs After

  <img width="714" alt="Screenshot 2020-02-16 at 9 24 58 PM" src="https://user-images.githubusercontent.com/10107633/74612132-de533180-5102-11ea-9cc4-296a16949d90.png">

 * Rendering the form - Before vs After with `ChoiceList` helpers

  <img width="670" alt="Screenshot 2020-02-16 at 9 26 51 PM" src="https://user-images.githubusercontent.com/10107633/74612155-122e5700-5103-11ea-9c16-5d80a7541f4b.png">

 * Submitting the form - Before vs After

  <img width="670" alt="Screenshot 2020-02-16 at 9 28 01 PM" src="https://user-images.githubusercontent.com/10107633/74612172-3be77e00-5103-11ea-9a18-4294e05402d2.png">

 * Submitting the form - Before vs After with `ChoiceList` helpers

  <img width="670" alt="Screenshot 2020-02-16 at 9 29 10 PM" src="https://user-images.githubusercontent.com/10107633/74612193-689b9580-5103-11ea-86b9-5b4906200021.png">

_________

TODO:
- [x] Docs
- [x] More profiling
- [x] Add some tests

#EUFOSSA

Commits
-------

b25973cc2e [Form] Added support for caching choice lists based on options
2020-02-21 08:55:09 +01:00
Fabien Potencier
f01bbc789c feature #35783 [Validator] Add the divisibleBy option to the Count constraint (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Validator] Add the divisibleBy option to the Count constraint

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

From my experience, it is sometimes useful to assert that the number of elements in a collection is a multiple of X.

Commits
-------

8dfb7b2ad1 [Validator] Add the divisibleBy option to the Count constraint
2020-02-21 08:45:55 +01:00
Fabien Potencier
d33a483575 feature #35649 [String] Allow to keep the last word when truncating a text (franmomu)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[String] Allow to keep the last word when truncating a text

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

The [truncate filter from twig/extensions](https://github.com/twigphp/Twig-extensions/blob/master/src/TextExtension.php#L36) has a `preserve` parameter to preserve whole words.

Since `twig/extensions` is deprecated and its alternative for `truncate` filter is the use of `u` filter, this PR adds preverse word functionality.

Commits
-------

1cfaeec378 [String] Allow to keep the last word when truncating a text
2020-02-21 08:43:56 +01:00
Jules Pietri
fef0de3eb6
[HttpFoundation] Fixed Mimes dependency missing error 2020-02-20 20:55:19 +01:00
Trevor North
971b177d27 Fix versioned namespace clears
When using namespace versioning to achieve atomic cache clears, only
delete cache keys matching the old/current version.

This resolves tag inconsistency issues whereby the process running the
clear would delete keys set against the new version by more recently
spawned concurreny processes. Most seriously this could result in newly
set data keys remaining, but with empty associated tag sets meaning the
invalidation via tags was no longer possible.

Clearing specific prefixes is not supported when using versioned
namespaces as it is desirable to clear all old keys as they will no
longer be used and would otherwise eventually fill cache memory.
2020-02-20 16:31:44 +00:00
Nicolas Grekas
7b1e4ea5e0 minor #35793 Use strict assertSame instead of assertEquals in Asset component tests (GromNaN)
This PR was merged into the 3.4 branch.

Discussion
----------

Use strict assertSame instead of assertEquals in Asset component tests

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/pull/35762#discussion_r381400521
| License       | MIT
| Doc PR        | N/A

Using `assertSame` instead of `assertEquals` is recommended when possible (see https://github.com/sebastianbergmann/phpunit-documentation-english/issues/3). It is stricter and must be more efficient ([`===`](https://github.com/sebastianbergmann/phpunit/blob/8.5.2/src/Framework/Constraint/IsIdentical.php#L63) vs a [comparator class](https://github.com/sebastianbergmann/phpunit/blob/8.5.2/src/Framework/Constraint/IsEqual.php#L79)).

~~Also, removing useless string cast.~~

Commits
-------

e8f3e84959 Use strict assertion in asset tests
2020-02-20 14:39:53 +01:00
Nicolas PHILIPPE
3515793cb3 fix remember me 2020-02-20 11:24:12 +01:00
Jérôme TAMARELLE
e8f3e84959 Use strict assertion in asset tests 2020-02-20 09:19:58 +01:00
Thomas Calvet
018ec1ae5c [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types 2020-02-19 23:15:50 +01:00
Nicolas Grekas
212841b3e6 bug #35772 [Config] don't throw on missing excluded paths (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Config] don't throw on missing excluded paths

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

Commits
-------

2f65a7a255 [Config] don't throw on missing excluded paths
2020-02-19 18:19:43 +01:00
Thomas Calvet
8dfb7b2ad1 [Validator] Add the divisibleBy option to the Count constraint 2020-02-19 17:59:38 +01:00
Nicolas Grekas
a81cbc99c7 bug #35774 [Ldap] force default network timeout (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Ldap] force default network timeout

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

The default network timeout is infinite, which makes no sense and can block workers.

Note that LDAP supports also "timelimit" options, but those are max-durations for LDAP queries. We cannot limit them by default.

Commits
-------

63f9e013a1 [Ldap] force default network timeout
2020-02-19 17:02:56 +01:00
Grégoire Pineau
094e4bbbc2 Do not rely on the current locale when dumping a Graphviz object
Funny bug !

With `de_DE.UTF-8` as locale:
```
php > echo sprintf('%s', 0.5);
0,5
php > echo sprintf('%d', 0.5);
0
php > echo sprintf('%f', 0.5);
0,500000
php > echo (string) 0.5;
0,5
```

So now we force `'0.5'`
2020-02-19 15:50:10 +01:00
Robin Chalas
1c24ccc635 fix typo 2020-02-18 22:48:57 +01:00
Fran Moreno
1cfaeec378 [String] Allow to keep the last word when truncating a text 2020-02-18 21:59:15 +01:00
Nicolas Grekas
63f9e013a1 [Ldap] force default network timeout 2020-02-18 14:07:02 +01:00
Jan Schädlich
ab4123ce68 [Notifier] Remove not needed argument $bus in BrowserChannel::notify() 2020-02-18 13:11:08 +01:00
Nicolas Grekas
2f65a7a255 [Config] don't throw on missing excluded paths 2020-02-18 12:18:14 +01:00
Fabien Potencier
5867c7e090 minor #35760 [Validator] Add the missing translations for the Polish ("pl") locale (przemyslaw-bogusz)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Add the missing translations for the Polish ("pl") locale

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

Fabbot indicates a typo, but there is no typo. The English word `address` is `adres` in Polish (with a single d and a single s).

Commits
-------

8c4de564a8 [Validator] Add the missing translations for the Polish ("pl") locale
2020-02-18 09:09:42 +01:00
Bogdan
7042ff86ec [Messenger] Add missing return in AmazonSqsReceiver::getMessageCount 2020-02-18 02:58:50 +02:00
Michael Käfer
dc11c8d1b8 Docs: Typo, grammar 2020-02-17 20:21:37 +01:00
Przemysław Bogusz
8c4de564a8 [Validator] Add the missing translations for the Polish ("pl") locale 2020-02-17 20:16:57 +01:00
Iliya Miroslavov Iliev
db6d360be8 [Notifier] added Sinch texter transport 2020-02-17 17:10:29 +01:00
Benjamin
771c642a43 [PhpUnitBridge] Add compatibility to PHPUnit 9 #35662 2020-02-17 09:30:34 +01:00
Jules Pietri
b25973cc2e
[Form] Added support for caching choice lists based on options 2020-02-16 16:50:19 +01:00
Mathias Arlaud
50d744589e [Routing] Add locale requirement for localized routes 2020-02-15 15:51:21 +01:00
Robin Chalas
e13470c823 [Console] Inline exact-match handling with 4.4 2020-02-15 14:27:16 +01:00
Nicolas Grekas
9acb06041c minor #35731 [Routing] marked configurators traits as internal (HeahDude)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Routing] marked configurators traits as internal

| Q             | A
| ------------- | ---
| Branch?       | master
| 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 https://github.com/symfony/symfony/pull/30501#discussion_r376806342 <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | not needed
<!--
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 master.
-->

Commits
-------

52efec76ad [Routing] marked configurators traits as internal
2020-02-15 11:42:33 +01:00
Nicolas Grekas
b92168c110 bug #35702 [VarDumper] fixed DateCaster not displaying additional fields (Makdessi Alex)
This PR was merged into the 3.4 branch.

Discussion
----------

[VarDumper] fixed DateCaster not displaying additional fields

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

----

Here's the result with [Holiday](https://github.com/azuyalabs/yasumi/blob/develop/src/Yasumi/Holiday.php) class

| before  | after
| ------- | -----
| ![before](https://user-images.githubusercontent.com/4425529/74445818-48f03d00-4e77-11ea-97e1-58d88ac52cba.png) | ![after](https://user-images.githubusercontent.com/4425529/74445825-4c83c400-4e77-11ea-8e8e-1fbbb1040438.png)

Commits
-------

f965971919 [VarDumper] fixed DateCaster not displaying additional fields
2020-02-15 11:39:34 +01:00
Nicolas Grekas
fcb833f26d minor #35717 time ( void ) : int (cbastienbaron)
This PR was merged into the 5.1-dev branch.

Discussion
----------

time ( void ) : int

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

no need to cast - micro improvement

Commits
-------

9f31581fd8 time ( void ) : int
2020-02-15 11:25:47 +01:00
bastien
9f31581fd8 time ( void ) : int
no need to cast
2020-02-15 11:25:26 +01:00
Jules Pietri
52efec76ad
[Routing] marked configurators traits as internal 2020-02-15 11:12:27 +01:00
Daniel Gorgan
87d51c1e4b Set previous exception when rethrown from controller resolver 2020-02-15 08:21:39 +01:00
Fabien Potencier
12f1c7c4a3 minor #35713 Fixes typo in error message. (dbrumann)
This PR was merged into the 4.4 branch.

Discussion
----------

Fixes typo in error message.

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

Fixes a minor typo where the error message refers to the wrong argument.

Commits
-------

8f2fbf6e2c Fixes typo in error message.
2020-02-15 08:19:38 +01:00
Fabien Potencier
f4e9293734 bug #35714 [HttpClient] Correctly remove trace level options for HttpCache (aschempp)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] Correctly remove trace level options for HttpCache

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

The `HttpCache` component allows to [configure a trace level](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L46). Due to the behavior of `CachingHttpClient`, options that are meant for the `HttpCache` must be unset before preparing the request. Currently these options can't be set, because `HttpClient` errors with invalid configuration options.

Commits
-------

618cd80b0d Correctly remove trace level options for HttpCache
2020-02-15 08:18:49 +01:00
Grégoire Paris
94b5dbde5a
Add missing autoload calls
Until either php 7.4 or doctrine/persistence 2 is required, these will
be needed to make sure php recognises signatures using the old names as
compatible with signatures using the new names.
This is necessary for types defined outside Symfony that extend types
from Symfony and still use the old names in signatures of methods they
override.

More details at https://dev.to/greg0ire/how-to-deprecate-a-type-in-php-48cf

Fixes https://github.com/doctrine/DoctrineMongoDBBundle/issues/616
2020-02-14 19:45:19 +01:00
Nicolas Grekas
f46ab58bcf feature #35673 [Process] Add getter for process starttime (dompie)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Process] Add getter for process starttime

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | issue #35531
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Add a getter for process start time.

Commits
-------

3b9ed3e378 [Process] Add getter for process starttime
2020-02-14 14:09:35 +01:00
Dominik Piekarski
3b9ed3e378 [Process] Add getter for process starttime 2020-02-14 14:09:17 +01:00
Makdessi Alex
f965971919 [VarDumper] fixed DateCaster not displaying additional fields 2020-02-14 13:39:29 +01:00
Nicolas Grekas
3f995ac602 [HttpKernel] fix registering DebugHandlersListener regardless of the PHP_SAPI 2020-02-14 11:01:23 +01:00
Nicolas Grekas
0f46aa602a [Contracts] Add changelog entry for "symfony/deprecation-contracts" 2020-02-14 10:07:39 +01:00
Nicolas Grekas
9181c3ad61 [Contracts] add missing changelog entries 2020-02-14 10:04:22 +01:00
Denis Brumann
8f2fbf6e2c
Fixes typo in error message. 2020-02-14 09:28:51 +01:00
Andreas Schempp
618cd80b0d Correctly remove trace level options for HttpCache 2020-02-14 09:25:43 +01:00
Fabien Potencier
4c1ca329a4 Merge branch '5.0'
* 5.0:
  fix unix root dir issue
  sync validator translation files with master
  fix anchor
  fix links to releases page (formerly known as "roadmap")
  [Console] Don't load same-namespace alternatives on exact match found
  [HttpKernel] Fix method name in doc comments
2020-02-14 08:43:15 +01:00
Fabien Potencier
05f71d3fd5 Merge branch '4.4' into 5.0
* 4.4:
  fix unix root dir issue
  sync validator translation files with master
  [HttpFoundation] fix not sending Content-Type header for 204 responses
  [ErrorHandler] silence warning when zend.assertions=-1
  fix anchor
  [Console] Handle zero row count in appendRow() for Table
  fix links to releases page (formerly known as "roadmap")
  [Console] Don't load same-namespace alternatives on exact match found
2020-02-14 08:43:07 +01:00
Fabien Potencier
7a6e3c07b3 Merge branch '3.4' into 4.4
* 3.4:
  fix unix root dir issue
  sync validator translation files with master
  fix anchor
  fix links to releases page (formerly known as "roadmap")
  [Console] Don't load same-namespace alternatives on exact match found
2020-02-14 08:42:58 +01:00
Christopher Hertel
9e431038b2 fix unix root dir issue 2020-02-14 08:34:21 +01:00
Fabien Potencier
c09128cf9f Merge branch '4.4'
* 4.4:
  [HttpFoundation] fix not sending Content-Type header for 204 responses
  [ErrorHandler] silence warning when zend.assertions=-1
  [Console] Handle zero row count in appendRow() for Table
2020-02-14 08:32:25 +01:00
Nicolas Grekas
d6fa13bafd [symfony/contracts] Reference one main CHANGELOG in each contracts 2020-02-14 08:31:56 +01:00
Fabien Potencier
1a7e4ea746 bug #35709 [HttpFoundation] fix not sending Content-Type header for 204 responses (Tobion)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpFoundation] fix not sending Content-Type header for 204 responses

| 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       |
| License       | MIT
| Doc PR        |

`$headers->remove('Content-Type')` did not actually work because PHP sends the Content-Type header based on the https://www.php.net/manual/en/ini.core.php#ini.default-mimetype ini setting anyway (which defaults to html). So we need to disable this ini for empty responses.

Commits
-------

06f5a1113d [HttpFoundation] fix not sending Content-Type header for 204 responses
2020-02-14 08:31:13 +01:00
Christian Flothmann
e171386299 sync validator translation files with master 2020-02-14 07:56:04 +01:00
Tobias Schultze
06f5a1113d [HttpFoundation] fix not sending Content-Type header for 204 responses 2020-02-13 20:40:01 +01:00
Nicolas Grekas
67ef532f8c [ErrorHandler] silence warning when zend.assertions=-1 2020-02-13 19:41:25 +01:00
Fabien Potencier
fb743a545f minor #35705 fix anchor (garak)
This PR was merged into the 3.4 branch.

Discussion
----------

fix anchor

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

This is a continuation of PR #35703 that was merged a bit too early.
It accepts suggestion made there and, moreover, fixes anchor link (that changed from old roadmap page)

Commits
-------

5825e3c58c fix anchor
2020-02-13 18:43:56 +01:00
Fabien Potencier
5b1e3ddda9 Fix package names 2020-02-13 18:19:37 +01:00
Massimiliano Arione
5825e3c58c
fix anchor 2020-02-13 16:21:59 +01:00
Fabien Potencier
e87b59971e bug #35676 [Console] Handle zero row count in appendRow() for Table (Adam Prickett)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Console] Handle zero row count in appendRow() for Table

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

When a `Table` is created and rendered with no rows (headers only) and subsequently rows are added using `appendRow()`, the first call to `appendRow()` clears back one line too far., thus removing the last run

This is caused by `calculateRowCount()` not accounting for the fact that the footer separator is also the header separator when no rows are present.

This PR works around the issue by checking to ensure that at least 1 row exists before including the footer separator in the row count.

## Example

Command:
```php
<?php

namespace App\Command;

class TableTestCommand extends Command
{
    // ...

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('My table');

        $table = new Table($output->section());
        $table->setHeaders(['Column', 'Another column']);
        $table->render();

        $table->appendRow(['Value', 'Another Value']);
        $table->appendRow(['Value', 'Another Value']);
    }
}
```

Before fix:
```
+--------+----------------+
| Column | Another column |
+--------+----------------+
| Value  | Another Value  |
| Value  | Another Value  |
+--------+----------------+
```

After fix:
```
My table
+--------+----------------+
| Column | Another column |
+--------+----------------+
| Value  | Another Value  |
| Value  | Another Value  |
+--------+----------------+
```

Commits
-------

9b382590ee [Console] Handle zero row count in appendRow() for Table
2020-02-13 16:06:04 +01:00
Adam Prickett
9b382590ee [Console] Handle zero row count in appendRow() for Table 2020-02-13 16:05:57 +01:00
Bozhidar Hristov
76ff984ab5 [String] Transliterate & to and 2020-02-13 16:03:58 +01:00
Fabien Potencier
648d488bb2 bug #35696 [Console] Don't load same-namespace alternatives on exact match (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[Console] Don't load same-namespace alternatives on exact match

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35479
| License       | MIT
| Doc PR        | -
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

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

Commits
-------

707c5bade0 [Console] Don't load same-namespace alternatives on exact match found
2020-02-13 16:01:49 +01:00
Massimiliano Arione
1c8fbe1cf9
fix links to releases page (formerly known as "roadmap") 2020-02-13 15:46:26 +01:00
Robin Chalas
707c5bade0 [Console] Don't load same-namespace alternatives on exact match found 2020-02-13 01:35:20 +01:00
Fabien Potencier
31fb219896 feature #34550 [Form] Added an AbstractChoiceLoader to simplify implementations and handle global optimizations (HeahDude)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Form] Added an AbstractChoiceLoader to simplify implementations and handle global optimizations

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | ~
| License       | MIT
| Doc PR        | ~
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

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

The `ChoiceLoaderInterface` is not easy to understand/implement, while its goal is simple, lazy load an array of choices.
What may seem complicated is the how/what to optimize loading, we need to deal with a `$value` callback (which refers to the `choice_value` option allowing to transform a model choice to a unique string value that can be displayed/submitted).

We have now enough implementations in core to justify the need of an abstraction and provide a better DX in the process.

Before this PR we needed to implement 3 methods to create a loader:
 - `loadChoiceList(?callable $value): ChoiceListInterface`
 - `loadChoicesForValues(array $values, ?callable $value): array`
 - `loadValuesForChoices(array $choices, ?callable $value): array`
and handle optimization, in each.

Now we only need to implement:
 - `loadChoices():  iterable`

and optionnally:
 - `doLoadChoicesForValues(array $values, ?callable $value): array`
if more optimization is needed to only load submitted values, (i.e the core intl loader prevents loading values that are the same as choices, and the doctrine one performs a `WHERE id IN ($ids)` query).

Commits
-------

1394df2dea [Form] Added an AbstractChoiceLoader to simplify implementations and handle global optimizations
2020-02-12 20:40:35 +01:00
Fabien Potencier
39f9ac2620 [Notifier] Simplify OVH implementation 2020-02-12 17:24:01 +01:00
Success Go
5888566a89 [HttpKernel] Fix method name in doc comments 2020-02-12 22:34:24 +08:00
Cyrille Bourgois
a49dead4e0
sms endpoint is only available in ovh-eu
Signed-off-by: Cyrille Bourgois <cyrille.bourgois@corp.ovh.com>
2020-02-12 14:30:49 +01:00
Antoine Leblanc
e65a8cffad
Remove deprecated endpoint
runabove has been closed.

Signed-off-by: Antoine Leblanc <antoine.leblanc@corp.ovh.com>
2020-02-12 12:02:15 +01:00
Fabien Potencier
da9f3af3e1 bug #35578 [Console][QuestionHelper] Use String width() to properly move the cursor backwards (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Console][QuestionHelper] Use String width() to properly move the cursor backwards

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/pull/35536#issuecomment-581343181
| License       | MIT
| Doc PR        | -

This bug can only be fixed on master since we need to require the String component. Once the component is required, we can iterate in the Console component to use it more where it is needed.

Commits
-------

67a1f55ce1 [Console][QuestionHelper] Use String width() to properly move the cursor backwards
2020-02-11 16:25:50 +01:00
Nicolas Grekas
b84faa4ee8 Merge branch '5.0'
* 5.0:
  [HttpClient] fix "undefined variable"
  [HttpClient] remove useless code in test
  [HttpClient] fix getting response content after its destructor throwed an HttpExceptionInterface
  [HttpClient] fix HttpClientDataCollector when handling canceled responses
  [Security] Fix exception name in doc comments
2020-02-11 15:27:37 +01:00
Nicolas Grekas
b43d418171 Merge branch '4.4' into 5.0
* 4.4:
  [HttpClient] fix "undefined variable"
  [HttpClient] remove useless code in test
  [HttpClient] fix getting response content after its destructor throwed an HttpExceptionInterface
  [HttpClient] fix HttpClientDataCollector when handling canceled responses
  [Security] Fix exception name in doc comments
2020-02-11 15:26:26 +01:00
Nicolas Grekas
ded655b669 Merge branch '3.4' into 4.4
* 3.4:
  [Security] Fix exception name in doc comments
2020-02-11 15:26:15 +01:00
Nicolas Grekas
7e734a3389 [HttpClient] fix "undefined variable" 2020-02-11 15:25:58 +01:00
Nicolas Grekas
d41ea2a02e [HttpClient] remove useless code in test 2020-02-11 15:05:45 +01:00
Fabien Potencier
acc98b775a Fix typos 2020-02-11 14:52:27 +01:00
Fabien Potencier
e0a6a7331c feature #34540 [Notifier] add OvhCloud bridge (antiseptikk)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Notifier] add OvhCloud bridge

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | See #33687
| License       | MIT

This would add OvhCloud sms integration for the Notifier component.
Tested with 'ovh-eu' entrypoint.

Inspiration : https://github.com/ovh/php-ovh

Commits
-------

76bfb85e26 [Notifier] add OvhCloud bridge
2020-02-11 14:51:31 +01:00
Thomas Ferney
76bfb85e26 [Notifier] add OvhCloud bridge 2020-02-11 14:51:25 +01:00
Nicolas Grekas
6d1657b720 [HttpClient] fix getting response content after its destructor throwed an HttpExceptionInterface 2020-02-11 14:51:01 +01:00
Nicolas Grekas
8c694d6157 [DomCrawler] fix leftover 2020-02-11 11:47:17 +01:00
Nicolas Grekas
1d34c8ca89 feature #35192 [PhpUnitBridge] Add the ability to expect a deprecation inside a test (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[PhpUnitBridge] Add the ability to expect a deprecation inside a test

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

Replaces https://github.com/symfony/symfony/pull/25757

Proposed implementation uses a dedicated trait for a better DX. Using `$this->expectDeprecation()` feels natural.

Unfortunately it is not currently possible to test the cases that should produce errors or risky, so there are some things that are not testable here. I plan to propose another feature for the PhpUnitBridge to be able to test those kind of things. If it's accepted, we will then be able to strenghten the tests of this one.

Commits
-------

a3a928050d [PhpUnitBridge] Add the ability to expect a deprecation inside a test
2020-02-11 11:38:57 +01:00
Thomas Calvet
a3a928050d [PhpUnitBridge] Add the ability to expect a deprecation inside a test 2020-02-11 11:38:45 +01:00
Matthias Meyer
7088ef78f7
[HttpClient] fix HttpClientDataCollector when handling canceled responses 2020-02-11 11:10:58 +01:00
Robin Chalas
bbeb49f32d minor #35671 [Messenger][Redis] Add missing changelog entry (chalasr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Messenger][Redis] Add missing changelog entry

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

Missed in #35384

Commits
-------

08fb0c4dfd [Messenger][Redis] Add missing changelog entry
2020-02-11 09:47:53 +01:00
Robin Chalas
08fb0c4dfd [Messenger][Redis] Add missing changelog entry 2020-02-11 09:47:07 +01:00
Fabien Potencier
1b52d6035a feature #35667 [DomCrawler] Rename UriExpander.php -> UriResolver (lyrixx)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[DomCrawler] Rename UriExpander.php -> UriResolver

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | refs https://github.com/symfony/symfony-docs/pull/13054#discussion_r377138605
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/13054 // don't open a new issue in doc repo

Commits
-------

3217f8182a [DomCrawler] Rename UriExpander.php -> UriResolver
2020-02-11 07:10:22 +01:00
Grégoire Pineau
3217f8182a [DomCrawler] Rename UriExpander.php -> UriResolver 2020-02-11 07:10:08 +01:00
Fabien Potencier
e5ccf5d558 minor #35668 Updated ICU urls (oleg-andreyev)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Updated ICU urls

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

Updated `@see` links to icu4c project (PHP docs has outdated links also)

Commits
-------

7adece8cc7 Updated ICU urls
2020-02-11 06:40:00 +01:00
Oleg Andreyev
7adece8cc7
Updated ICU urls 2020-02-10 23:25:54 +02:00
Fabien Potencier
a9eec7169a minor #35663 [Contracts] Split the global CHANGELOG in dedicated CHANGELOG per contract (lyrixx)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Contracts] Split the global CHANGELOG in dedicated CHANGELOG per contract

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

---

This is more in sync with what we do with other components + bundles.
And when we contribute to a contact, it's easier to find the file (because with the substree, we don't get the global package)

Commits
-------

a05ee087a2 [Constracts] Split the global CHANGELOG in dedicated CHANGELOG per contract
2020-02-10 21:09:55 +01:00
Nicolas Grekas
033ec1bc0f feature #35611 [Console] Moved estimated & remaining calculation logic to separate get method (peterjaap)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Console] Moved estimated & remaining calculation logic to separate get method

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

This way, we can use `getEstimated()`and `getRemaining()` to get easy access to the estimated / remaining number of seconds to be used in our placeholder definition set with `setPlaceholderFormatterDefinition` without having to redefine the calculation ourself.

Example before;

```php
ProgressBar::setPlaceholderFormatterDefinition(
    'eta',
    function (ProgressBar $progressBar) {
        $estimated = round((time() - $progressBar->getStartTime()) / ($progressBar->getProgress() ?: 0.1) * $progressBar->getMaxSteps());
        return date('H:i:s', strtotime('+' . $estimated . ' seconds'));
    }
);
```

Example after;

```php
ProgressBar::setPlaceholderFormatterDefinition(
    'eta',
    function (ProgressBar $progressBar) {
        return date('H:i:s', strtotime('+' . $this->getEstimated() . ' seconds'));
    }
);
```

Commits
-------

19958fba5a [Console] Moved estimated & remaining calculation logic to separate get method
2020-02-10 17:05:15 +01:00
Peter Jaap Blaakmeer
19958fba5a [Console] Moved estimated & remaining calculation logic to separate get method 2020-02-10 17:05:09 +01:00
Fabien Potencier
7e4abf5e9d feature #33968 [Notifier] Add Firebase bridge (Jeroeny)
This PR was squashed before being merged into the 5.1-dev branch (closes #33968).

Discussion
----------

[Notifier] Add Firebase bridge

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | See #33687
| License       | MIT

This would add [Firebase](https://firebase.google.com) integration for the Notifier component. With Firebase you can send push notifications to the users of you Android and iOS app and website (formerly known as Google Cloud messaging).

I'm not sure if it's possible to have this merged, like the other bridges. Or if I should create a stand-alone repository? That'd be fine too.

Also it's now using the `ChatMessage` as implementation of `Symfony\Component\Notifier\Message\MessageInterface`, but I feel like this component could use a `PushMessage` or something similar. Although I'm not sure if it would contain more than `subject` that the `ChatMessage` does.

Commits
-------

2776d2f811 [Notifier] Add Firebase bridge
2020-02-10 16:35:00 +01:00
Jeroeny
2776d2f811 [Notifier] Add Firebase bridge 2020-02-10 16:34:55 +01:00
Jeroeny
4869ef61cd [Notifier] add RocketChat bridge 2020-02-10 16:33:29 +01:00
Fabien Potencier
4003700e90 feature #32454 [Messenger] Add SQS transport (jderusse)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Messenger] Add SQS transport

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | TODO

This PR add the AWS SQS transport in messenger.

It also add a `DisconnectedReceiverInterface` that allows the worker to release not-proceeded message (which are not automatically released in SQS and have to wait a TTL). Tell me if you prefer to move it in a dedicated PR.

accepted DNS:
- `sqs://default/accountId/queueName`
- `sqs://default/queueName`
- `sqs://default/queueName?region=us-east-2`
- `sqs://my_custome_endpoint:12345/queueName?sslmode=disabled`

To reduce AWS costs, the implementation performs a long polling call and prefetch several messages.
TO get ~real time worker, one could use `./bin/console messenger:consume --sleep 0.001`

Commits
-------

c226479d5f [Messenger] Add SQS transport
2020-02-10 13:30:37 +01:00
Grégoire Pineau
a05ee087a2 [Constracts] Split the global CHANGELOG in dedicated CHANGELOG per contract 2020-02-10 11:54:33 +01:00
Thomas Calvet
67a1f55ce1 [Console][QuestionHelper] Use String width() to properly move the cursor backwards 2020-02-10 10:12:08 +01:00
Emanuele Panzeri
eaba6a507c Add Mattermost notifier bridge 2020-02-10 10:04:31 +01:00
Fabien Potencier
9eb7cb1b7b feature #35400 [RFC][DX][OptionsResolver] Allow setting info message per option (yceruto)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[RFC][DX][OptionsResolver] Allow setting info message per option

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

This is a DX proposal that will help in debugging/errors to better understand the meaning of one defined option.

This is how you'd use it:
```php
$resolver = new OptionsResolver();
$resolver->setDefined('date');
$resolver->setAllowedTypes('date', \DateTime::class);
$resolver->setInfo('date', 'A future date'); // <-- NEW
// ...
```
This information may be useful for those options where their name cannot be intuitive enough, or their purpose is too complex. Here is an example (based on the example above):
```php
// ...
$resolver->setAllowedValues('date', static function ($value): bool {
    return $value >= new \DateTime('now');
});
```
So, if you introduce a date value that does not match the criteria, you will get this error message:

**Before:**
```
The option "date" with value DateTime is invalid.
```
Note that the allowed value is not printable in this case, hence the error message cannot be clear at all.

**After:**
```
The option "date" with value DateTime is invalid. Info: A future date.
```
Although a more accurate error message can be triggered within the `\Closure` if desired.

Also you'll see this info message on `debug:form` command (see tests), then you have in advance the informative description of any option.

What do you think?

Commits
-------

0477a06d8a Allow setting one info message per option
2020-02-10 09:05:33 +01:00
Fabien Potencier
9e0a39ee05 minor #35657 [Security] Fix exception name in doc comments (chalasr)
This PR was squashed before being merged into the 3.4 branch (closes #35657).

Discussion
----------

[Security] Fix exception name in doc comments

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

Commits
-------

f10098e9f1 [Security] Fix exception name in doc comments
2020-02-10 09:04:06 +01:00
Robin Chalas
f10098e9f1 [Security] Fix exception name in doc comments 2020-02-10 09:03:59 +01:00
Yonel Ceruto
0477a06d8a Allow setting one info message per option 2020-02-09 19:42:47 -05:00
Jules Pietri
1394df2dea [Form] Added an AbstractChoiceLoader to simplify implementations and handle global optimizations 2020-02-10 00:49:37 +01:00
Nicolas Grekas
332fa65f69 [FrameworkBundle] fix typo 2020-02-09 21:32:53 +01:00
Jules Pietri
de74794acf [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers 2020-02-09 17:37:08 +01:00
Fabien Potencier
9bfa25869a feature #35373 [Translation] Support name attribute on the xliff2 translator loader (Taluu)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Translation] Support name attribute on the xliff2 translator loader

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #32048
| License       | MIT
| Doc PR        | not done yet

Support using the `name` attribute on the `unit` element in xliff 2.0 to use as the "translation key" rather than always relying on the `<source>` content, as was done on the xliff 1.2.

Commits
-------

37b31149c6 Support name attribute on the xliff2 translator loader
2020-02-09 08:48:01 +01:00
Nicolas Grekas
083a32dee3 Merge branch '5.0'
* 5.0:
  Add missing symfony/mime to require-dev
  [Validator] Added the missing Mongolian translations
  [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
  refactor(Process): fromShellCommandLine
  [Mailer] Do not ping the SMTP server before sending every message
2020-02-08 18:01:13 +01:00
Nicolas Grekas
255a748f1f Merge branch '4.4' into 5.0
* 4.4:
  Add missing symfony/mime to require-dev
  [Validator] Added the missing Mongolian translations
  [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
  refactor(Process): fromShellCommandLine
  [Mailer] Do not ping the SMTP server before sending every message
2020-02-08 18:00:58 +01:00
Nicolas Grekas
48272f000a Add missing symfony/mime to require-dev 2020-02-08 17:59:15 +01:00
Nicolas Grekas
c771557213 Merge branch '3.4' into 4.4
* 3.4:
  [Validator] Added the missing Mongolian translations
2020-02-08 17:57:24 +01:00
Nicolas Grekas
3e35d8e9e3 Leverage trigger_deprecation() from symfony/deprecation-contracts 2020-02-08 15:04:50 +01:00
Nicolas Grekas
0032b2a289 [Contracts/Deprecation] don't use assert(), rename to trigger_deprecation() 2020-02-08 14:27:18 +01:00
Erkhembayar Gantulga
365f4d76bd [Validator] Added the missing Mongolian translations
https://github.com/symfony/symfony/issues/30175

Added the missing translations for the Mongolian ("mn") locale.
2020-02-08 18:24:04 +08:00
Fabien Potencier
916ff106c5 feature #33456 [MonologBridge] Add Mailer handler (BoShurik)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[MonologBridge] Add Mailer handler

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #33209   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - 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 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

5b7393b823 Add monolog mailer handler
2020-02-08 09:01:20 +01:00
Fabien Potencier
4bc1ea21b9 feature #35384 [Messenger] Add receiving of old pending messages (redis) (toooni)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Messenger] Add receiving of old pending messages (redis)

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

This PR makes it possible for the redis transport to get abandoned messages from not running/idle consumers by using `XPENDING` and `XCLAIM`.
Usually it would be best to let the claiming of pending messages be handled by a separate command. Since the messenger component's commands are fixed, we do need to set a `claimTimeout`. The `claimTimeout` defines how long an idle message should be left alone until it will get claimed by the current consumer (Must be a value higher than the longest running handling time of a message or else the message will be handled twice).
Using this solution makes the remarks (https://github.com/symfony/symfony-docs/pull/11869#pullrequestreview-257483666) regarding not being able to use the hostname as consumer name obsolete. I would even recommend the hostname as the consumer name.

**Questions**

- [x] Which value should we use as default `claimTimeout`?
- [x] How should the `claimTimeout` be configured?
- [x] Feature or Bugfix?

I will create a docs PR and a PR for the other branches as soon as the questions are resolved.

Commits
-------

9cb6fdfabb Implemted receiving of old pending messages
2020-02-08 08:48:00 +01:00
Fabien Potencier
32ce188b68 feature #34456 [Validator] Add a constraint to sequentially validate a set of constraints (ogizanagi)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Validator] Add a constraint to sequentially validate a set of constraints

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | N/A <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | Todo

Follows https://github.com/symfony/symfony/issues/20017#issuecomment-331276007 given some feedbacks about the suggested feature.

```php
/**
 * @var string
 *
 * @Assert\Sequentially({
 *     @Assert\Type("string"),
 *     @Assert\Length(min="4"),
 *     @Assert\Regex("[a-z]"),
 *     @SomeCustomConstraintWithHeavyExternalCalls(),
 * })
 */
public $foo;
```

This new `Sequentially` constraint solves - with less power but better DX - some of the use-cases of the `GroupSequence` feature, allowing to interrupt the validation of some constraints if a previous one in the list failed before. Constraints are validated in given order, and the first violation raised will prevent other constraint validators to be executed.
It can either prevent unexpected type exceptions thrown by further constraints or heavy & unnecessary calls to a database or external services if the value to validate already doesn't match some of the basic requirements.

Commits
-------

dfd9038d28 [Validator] Add a constraint to sequentially validate a set of constraints
2020-02-08 08:14:30 +01:00
Fabien Potencier
f53ea3d04f feature #34334 [Validator] Allow to define a reusable set of constraints (ogizanagi)
This PR was squashed before being merged into the 5.1-dev branch (closes #34334).

Discussion
----------

[Validator] Allow to define a reusable set of constraints

| Q             | A
| ------------- | ---
| Branch?       | 5.1 <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | N/A <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | TODO

The goal of this feature is to simplify writing a set of validation constraints to be reused consistently across the application. Which is especially useful with DTOs, as a same set of constraints can be used in different places.

For instance, given multiple DTOs containing the new user password in for different use-cases (register, forgot pwd, change pwd), the same rules apply on the property. Hence with this PR, you can write a single constraint class to be reused:

```php
/**
 * @Annotation
 */
class MatchesPasswordRequirements extends Compound
{
    protected function getConstraints(array $options): array
    {
        return [
            new NotBlank(),
            new Type('string'),
            new Length(['min' => 12]),
            new NotCompromisedPassword(),
        ];
    }
}
```

I'm open to better naming and ways to expose the options to the `Compound::getConstraints` method, so options can be forwarded to the nested constraints for most specific use-cases.

Commits
-------

8f1b0dfdb7 [Validator] Allow to define a reusable set of constraints
2020-02-08 08:09:39 +01:00
Maxime Steinhausser
8f1b0dfdb7 [Validator] Allow to define a reusable set of constraints 2020-02-08 08:09:33 +01:00
Fabien Potencier
2d89ed1f26 bug #35641 [Process] throw when PhpProcess::fromShellCommandLine() is used (Guikingone)
This PR was merged into the 4.4 branch.

Discussion
----------

[Process] throw when PhpProcess::fromShellCommandLine() is used

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

Close #35638

Final PR (rebased and tests added)

Commits
-------

7f6d71c2a3 refactor(Process): fromShellCommandLine
2020-02-08 08:06:43 +01:00
Fabien Potencier
f4490a6c65 feature #35642 [HttpFoundation] Make dependency on Mime component optional (atailouloute)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpFoundation] Make dependency on Mime component optional

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

Make the Mime component dependency optional

/cc @nicolas-grekas

Commits
-------

11cef32ff7 [HttpFoundation] Make dependency on Mime component optional
2020-02-08 08:05:09 +01:00
Fabien Potencier
138439adc6 bug #35645 [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable() (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()

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

Because we don't use `assert()`, this is something we completely overlooked, but warnings triggered should not throw as there is already a dedicated exception mode when using `assert()`.

This turns this exception mode to 1 in debug mode and logs the assert() warnings in prod.

Commits
-------

f18ef6ca08 [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
2020-02-08 08:03:35 +01:00
Fabien Potencier
4253251278 feature #35635 [HttpKernel] Make ErrorListener unaware of the event dispatcher (derrabus)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpKernel] Make ErrorListener unaware of the event dispatcher

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

Under certain circumstances, HttpKernel's `ErrorListener` class might dynamically register and unregister a listener with the dispatcher. If our goal is to make the dispatcher immutable, that specific behavior would be in our way. Also, #34988 would break this workflow.

This PR provides an alternative. The listener is always registered, but I'm using the request to piggyback a flag that activates/deactivates the listener.

Commits
-------

a9d1dede44 [HttpKernel] Make ErrorListener unaware of the event dispatcher.
2020-02-08 08:02:19 +01:00
Nicolas Grekas
f18ef6ca08 [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable() 2020-02-08 00:29:13 +01:00
Ahmed TAILOULOUTE
11cef32ff7 [HttpFoundation] Make dependency on Mime component optional 2020-02-07 21:28:17 +01:00
Loulier Guillaume
7f6d71c2a3
refactor(Process): fromShellCommandLine 2020-02-07 21:06:44 +01:00
Fabien Potencier
cb424805f8 bug #35633 [Mailer] Do not ping the SMTP server before sending every message (micheh)
This PR was squashed before being merged into the 4.4 branch (closes #35633).

Discussion
----------

[Mailer] Do not ping the SMTP server before sending every message

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

This pull request changes the SMTP transport to only ping the server if the last message was sent more than a specified number of seconds ago (instead of pinging the server before every message). By default, it will ping the server if 100 or more seconds since the last message have passed.

This should make sending emails with the SMTP transport more robust with many emails, as SMTP servers will often drop the connection if too many non-mail commands are sent (like pinging the server with NOOP commands).

Commits
-------

28178108d3 [Mailer] Do not ping the SMTP server before sending every message
2020-02-07 17:56:44 +01:00
Michel Hunziker
28178108d3 [Mailer] Do not ping the SMTP server before sending every message 2020-02-07 17:56:37 +01:00
Maxime Steinhausser
dfd9038d28 [Validator] Add a constraint to sequentially validate a set of constraints 2020-02-07 17:16:17 +01:00
Nicolas Grekas
83a53a5edf [VarDumper] fix transient failure 2020-02-07 16:06:29 +01:00
Alexander M. Turek
a9d1dede44 [HttpKernel] Make ErrorListener unaware of the event dispatcher. 2020-02-07 15:36:38 +01:00
Claus Due
7a7c9665da [YAML] Improve performance of YAML parser
Optimise various methods and conditions to use best
performing alternatives where possible. Roughly:

* Uses methods that do not copy memory, e.g. strncmp
  as alternative for strpos matching beginning of string.
* Switches order of some conditions to put the cheapest
  checks first in order.
* Checks input before calling trim() - despite the function
  returning the same string as input, it still costs memory
  and introduces unnecessary overhead.
* Extracts variables for repeated identical function calls.
* Uses negative substring offsets instead of strlen + substr.
* Replaces single-char substr usages with substring access.
2020-02-07 15:17:29 +01:00
Nicolas Grekas
47f467a4cc [FrameworkBundle] fix fix fix deps=low 2020-02-07 10:13:59 +01:00
Nicolas Grekas
16dd360511 [FrameworkBundle] fix fix deps=low 2020-02-07 10:12:20 +01:00
Nicolas Grekas
02e5d73116 [FrameworkBundle] fix deps=low 2020-02-07 10:11:45 +01:00
Nicolas Grekas
8b121a2c4d Merge branch '5.0'
* 5.0:
  [FrameworkBundle] fix "samesite" in XSD
  [Console] Consider STDIN interactive
  Update UserPasswordEncoderCommand.php
  [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
  [DoctrineBridge] Fixed submitting ids with query limit or offset
2020-02-07 09:49:04 +01:00
Nicolas Grekas
2f836ac8b2 Merge branch '4.4' into 5.0
* 4.4:
  [FrameworkBundle] fix "samesite" in XSD
  [Console] Consider STDIN interactive
  Update UserPasswordEncoderCommand.php
  [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
  [DoctrineBridge] Fixed submitting ids with query limit or offset
2020-02-07 09:48:51 +01:00
Nicolas Grekas
df41ca5b71 Merge branch '3.4' into 4.4
* 3.4:
  [FrameworkBundle] fix "samesite" in XSD
  Update UserPasswordEncoderCommand.php
  [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
  [DoctrineBridge] Fixed submitting ids with query limit or offset
2020-02-07 09:47:19 +01:00
Nicolas Grekas
abac71b0a4 [FrameworkBundle] fix "samesite" in XSD 2020-02-07 09:43:36 +01:00
Nicolas Grekas
ca570d31b8 feature #35019 [Cache] add SodiumMarshaller (atailouloute)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Cache] add SodiumMarshaller

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

Add `SodiumMarshaller` to encrypt cache values

To use the `SodiumMarshaller` we can decorate the `cache.default_marshaller`:

```yaml
Symfony\Component\Cache\Marshaller\SodiumMarshaller:
    decorates: cache.default_marshaller
    arguments:
        - ['%env(CACHE_DECRYPTION_KEY)%', '%env(OLD_CACHE_DECRYPTION_KEY)%']
        - '@Symfony\Component\Cache\Marshaller\SodiumMarshaller.inner'
```

The first provided key is used to encrypt and decrypt cached values.

In order to allow rotating keys, more keys can be provided - they will be used only to decrypt values.

/cc @nicolas-grekas

Commits
-------

540d7eb174 [Cache] add SodiumMarshaller
2020-02-07 09:34:21 +01:00
Gabriel Ostrolucký
ef157d5b3f [Console] Consider STDIN interactive 2020-02-07 09:29:36 +01:00
Thomas Calvet
659cdf1871 [String] Add the s() helper method 2020-02-07 08:57:11 +01:00
Fabien Potencier
f350f532b7 bug #35605 [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies (fabpot)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpFoundation][FrameworkBundle] fix support for samesite in session cookies

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

This PR cherry-picks #28168 on 3.4, with a rationale given by @ConneXNL in https://github.com/symfony/symfony/issues/35520#issuecomment-582296847:

> I hope I am wrong but I see the impact of not making any changes to Symfony 3.4 will have a tons of sites break if we cannot set the cookie's samesite setting (in the framework session and remember me) before Chrome pushes this update.
>
> Very soon all existing cookies are no longer going to work with cross-domains if you do not specify 'None' for the cookie_samesite. All external APIs that use cookies and are running SF 3.4 will break and devs will have no quick solution to fix their auth process.
>
> If you are using PHP 7.4, yes you can most likely use ini_set to workaround this issue.
>
> However, ini_set('cookie_samesite') does not work in PHP Version <= 7.2.
I am not even sure PHP 7.3 supports the value 'None' as php.watch/articles/PHP-Samesite-cookies says it has support for 'Lax' and 'Scrict'.
>
> This effectively means SF 3.4 on PHP 7.2 (or PHP 7.3) is no longer supported for cross domain APIs with cookies. People would have to either update PHP to 7.4 (if they even can?) or go to Symfony 4 (with a dead live site is going to be a complete disaster).
>
> Since the impact of the change that chrome is about to roll out is so fundamentally changing our way to set cookies, I consider configuring samesite configuration in the framework an absolute requirement, not a feature, especially since SF 3.4 is still supported.
>
> What am i missing?
>
> Note: SF3 HTTPFoundation already supports the new cookie settings, it's just the framework that doesn't support it.

Our BC policy embeds the promise that one should be able to keep the same app on a newest infrastructure (eg that's why supporting a PHP version is a bug fix). I think we can consider this for browsers here also. WDYT?

Commits
-------

f46e6cb8a0 [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
2020-02-07 08:56:52 +01:00
Fabien Potencier
e41a31236a bug #35609 [DoctrineBridge] Fixed submitting ids with query limit or offset (HeahDude)
This PR was merged into the 3.4 branch.

Discussion
----------

[DoctrineBridge] Fixed submitting ids with query limit or offset

| Q             | A
| ------------- | ---
| Branch?       | 3.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       | Fix https://github.com/symfony/symfony/pull/34900#discussion_r375246113 <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | ~ <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

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

Commits
-------

9bb194098f [DoctrineBridge] Fixed submitting ids with query limit or offset
2020-02-07 08:54:38 +01:00
Wim Molenberghs
3604bb7018 Update UserPasswordEncoderCommand.php 2020-02-07 08:49:54 +01:00
Fabien Potencier
31da954f9b feature #35624 [String] Remove the @experimental status (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[String] Remove the @experimental status

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/pull/35578#discussion_r375955786
| License       | MIT
| Doc PR        | -

Commits
-------

3d15f91723 [String] Remove the @experimental status
2020-02-07 08:48:56 +01:00
Lorenzo Millucci
1ff56407e1 [OptionsResolver] Add new OptionConfigurator class to define options with fluent interface 2020-02-06 21:33:59 +01:00
Nicolas Grekas
1c28bf7045 Merge branch '5.0'
* 5.0:
  [PhpUnitBridge] cs fix
  [Workflow] Make method signature compatible with 4.4
2020-02-06 18:01:40 +01:00
Nicolas Grekas
2e27c4fdf4 Merge branch '4.4' into 5.0
* 4.4:
  [PhpUnitBridge] cs fix
2020-02-06 18:01:19 +01:00
Nicolas Grekas
cd2dec3a7f [PhpUnitBridge] cs fix 2020-02-06 18:00:39 +01:00
Thomas Calvet
3d15f91723 [String] Remove the @experimental status 2020-02-06 17:58:08 +01:00
Peter Bowyer
474be9613b [Workflow] Make method signature compatible with 4.4 2020-02-06 14:45:03 +01:00
Fabien Potencier
e87f86b550 feature #35076 [DI] added possibility to define services with abstract arguments (Islam93)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[DI] added possibility to define services with abstract arguments

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

feature caused by rfc #31769 from issues list
I hope, this PR will be useful

   Abstract argument have to replaced by one of compiler passes or exception will be thrown.
   Example:
   This service definition
   ```xml
   ...
    <service id="App\Test\Test">
       <argument key="$a" type="abstract">should be defined by TestPass</argument>
    </service>
   ...
   ```
or this for yaml
```yaml
    App\Test\Test:
        arguments:
            $a: !abstract should be defined by TestPass
```
   causes exception like `Argument "$a" of service "App\Test\Test" is abstract (should be defined by TestPass), did you forget to define it?`
   if argument was not replaced by compiler pass
   ```php
   ...
    public function process(ContainerBuilder $container)
    {
        $test = $container->getDefinition(Test::class);
        $test->setArgument('$a', 'test');
    }
   ...
   ```

Commits
-------

62fefaa59f [DI] added possibility to define services with abstract arguments
2020-02-06 14:42:43 +01:00
Ahmed TAILOULOUTE
540d7eb174 [Cache] add SodiumMarshaller 2020-02-06 11:37:31 +01:00
Fabien Potencier
f46e6cb8a0 [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies 2020-02-06 09:18:51 +01:00
Ion Bazan
d5bcaff00c
Fix Contracts autoloader typo 2020-02-06 11:10:55 +08:00
Islam93
62fefaa59f [DI] added possibility to define services with abstract arguments 2020-02-05 20:15:48 +01:00
Jules Pietri
9bb194098f [DoctrineBridge] Fixed submitting ids with query limit or offset 2020-02-05 19:57:26 +01:00
Nicolas Grekas
1db7005c2c Merge branch '5.0'
* 5.0:
  [Bridge/PhpUnit] fix compat with recent versions of phpunit
2020-02-05 19:46:44 +01:00
Nicolas Grekas
29e5222498 Merge branch '4.4' into 5.0
* 4.4:
  [Bridge/PhpUnit] fix compat with recent versions of phpunit
2020-02-05 19:46:35 +01:00
Nicolas Grekas
cacb503294 [Bridge/PhpUnit] fix compat with recent versions of phpunit 2020-02-05 19:46:15 +01:00
Nicolas Grekas
32f2374426 Merge branch '5.0'
* 5.0:
  [Bridge/PhpUnit] fix parse error on PHP5
  Replace 403 with 401 in onAuthenticationFailure method
2020-02-05 19:24:38 +01:00
Nicolas Grekas
63bdce4847 Merge branch '4.4' into 5.0
* 4.4:
  [Bridge/PhpUnit] fix parse error on PHP5
  Replace 403 with 401 in onAuthenticationFailure method
2020-02-05 19:24:05 +01:00
Nicolas Grekas
c31ce63221 [Bridge/PhpUnit] fix parse error on PHP5 2020-02-05 19:23:47 +01:00
Fabien Potencier
829fc725c5 feature #35608 [Routing] add priority option to annotated routes (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Routing] add priority option to annotated routes

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

This PR allows defining the priority of routes using annotations:
`@Route(name="foo", priority=10)`

As requested [in this comment](https://github.com/symfony/symfony/pull/26132#pullrequestreview-352321332), priority is reserved to using annotations. For other formats, the order works fine.

Commits
-------

8522a83217 [Routing] add priority option to annotated routes
2020-02-05 19:16:11 +01:00
Fabien Potencier
8c596bce30 feature #35526 [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices

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

This PR results from a discussion we had yesterday with @alcaeus, @beberlei and others at the Symfony UG meetup in Berlin (thanks SensioLabs for bringing me there).

It provides a generic function and convention to trigger deprecation notices, which could be a better alternative to the `@trigger_error(..., E_USER_DEPRECATED)` calls that we use currently.

This proposed package would provide a single global function named `deprecated()`.
Its purpose is to trigger deprecations in a way that can be silenced on production environment
by using the `zend.assertions` ini setting and that can be caught during development to generate reports.

The function requires at least 3 arguments:
 - the name of the package that is triggering the deprecation
 - the version of the package that introduced the deprecation
 - the message of the deprecation
 - more arguments can be provided: they will be inserted in the message using `printf()` formatting

Example:
```php
deprecated('symfony/blockchain', 8.9, 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin');
```

This will generate the following message:
`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.`

Check #35550 to see how using this function could look like on Symfony itself.

Commits
-------

f0f41cbfc5 [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices
2020-02-05 19:14:04 +01:00
Nicolas Grekas
625ec1b7d7 Merge branch '3.4' into 4.4
* 3.4:
  Replace 403 with 401 in onAuthenticationFailure method
2020-02-05 19:11:18 +01:00
Nicolas Grekas
f0f41cbfc5 [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices 2020-02-05 19:04:04 +01:00
Nicolas Grekas
8522a83217 [Routing] add priority option to annotated routes 2020-02-05 19:01:26 +01:00
Nicolas Grekas
86573147b3 feature #32747 [Form] Add "is empty callback" to form config (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Form] Add "is empty callback" to form config

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/31572 for 4.4+
| License       | MIT
| Doc PR        | -

This PR introduces a new feature that allow to resolve a bug.

Currently, the `isEmpty()` behavior of the `Form` class is the same whatever its configuration. That prevents us to specify a different behavior by form type.

But I think that some form types should have dedicated empty values. For example, the `CheckboxType` model data either resolves to `true` (checked) or `false` (unchecked). But `false` is not an empty value in the `Form::isEmpty()` method, so a `CheckboxType` form can never be empty. `false` should not be in that list because for other form types, it's perfectly fine that it's not considered as an empty value.

The problem is better seen in https://github.com/symfony/symfony/issues/31572 with a `ChoiceType` that is never considered as empty (when no radio button is checked).

Being able to specify the "is empty" behavior by form type would also allow users to define their own logic in their custom form types + probably define it ourselves in all our form types in order to get rid of the default common behavior.

Commits
-------

7bfc27e7cf [Form] Add "is empty callback" to form config
2020-02-05 17:32:36 +01:00
Alan Poulain
73bc793be2
Replace 403 with 401 in onAuthenticationFailure method 2020-02-05 17:32:02 +01:00
Fabien Potencier
3bcf8cbc2d feature #34884 [DI] Enable auto alias compiler pass by default (X-Coder264)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[DI] Enable auto alias compiler pass by default

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

I'm sending this PR to trigger a discussion as @nicolas-grekas suggested in #34194

I'm using this quite a lot in one of my applications and I don't see any reasons why it shouldn't be enabled by default.

Commits
-------

4fde51745b Enable auto alias compiler pass by default
2020-02-05 17:15:57 +01:00
Nicolas Grekas
33c294fc39 Merge branch '5.0'
* 5.0:
  [PhpUnitBridge] fix getting the vendor/ dir for tests
2020-02-05 13:07:47 +01:00
Nicolas Grekas
435018529c Merge branch '4.4' into 5.0
* 4.4:
  [PhpUnitBridge] fix getting the vendor/ dir for tests
2020-02-05 13:07:42 +01:00
Nicolas Grekas
341dd5dd1d [PhpUnitBridge] fix getting the vendor/ dir for tests 2020-02-05 13:07:20 +01:00
Grégoire Pineau
cd8a386284 [Messenger] Made final class really final 2020-02-05 11:10:06 +01:00
Nicolas Grekas
115de5a756 Merge branch '5.0'
* 5.0:
  Provide current file as file path
2020-02-05 10:24:01 +01:00
Nicolas Grekas
b0cb757909 Merge branch '4.4' into 5.0
* 4.4:
  Provide current file as file path
2020-02-05 10:23:33 +01:00
Grégoire Paris
d5302cb5d2 Provide current file as file path 2020-02-05 10:22:11 +01:00
Robin Chalas
2646fa9eb8 [Serializer] Added missing changelog entry 2020-02-05 10:18:48 +01:00
Toni Rudolf
9cb6fdfabb Implemted receiving of old pending messages 2020-02-05 09:54:08 +01:00
Kévin Dunglas
d7bca80007
[Serializer] Add support for stdClass 2020-02-05 01:28:27 +01:00
Nicolas Grekas
33e2735d14 Merge branch '5.0'
* 5.0:
  [Mailer] fix merge
2020-02-04 23:28:14 +01:00
Nicolas Grekas
7f28ff0cb8 Merge branch '4.4' into 5.0
* 4.4:
  [Mailer] fix merge
2020-02-04 23:28:08 +01:00
Nicolas Grekas
abeee5f018 [Mailer] fix merge 2020-02-04 23:28:01 +01:00
Nicolas Grekas
0db2b0a4bc Merge branch '5.0'
* 5.0:
  [Mailer] fix typos
  [Messenger] fix typo
  [DI] Unknown env prefix not regornized as such
  [DI] Fix support for multiple tags for locators and iterators
  [PhpUnitBridge] Fix some errors when using serialized deprecations
  Fix HTTP client config handling
2020-02-04 20:57:28 +01:00
Nicolas Grekas
74a42d102f Merge branch '4.4' into 5.0
* 4.4:
  [Mailer] fix typos
  [Messenger] fix typo
  [DI] Unknown env prefix not regornized as such
  [DI] Fix support for multiple tags for locators and iterators
  [PhpUnitBridge] Fix some errors when using serialized deprecations
  Fix HTTP client config handling
2020-02-04 20:55:45 +01:00
Nicolas Grekas
88b4579942 [Mailer] fix typos 2020-02-04 20:55:13 +01:00
Nicolas Grekas
5ae1384e8f [Messenger] fix typo 2020-02-04 20:51:39 +01:00
Roland Franssen
550819a655 [DI] Unknown env prefix not regornized as such 2020-02-04 16:57:17 +01:00
Alexandre Parent
6fc91eb192 [DI] Fix support for multiple tags for locators and iterators 2020-02-04 16:30:04 +01:00
Ashura
b1b724f716 Update bootstrap_4_layout.html.twig 2020-02-04 15:31:16 +01:00
Laurent VOULLEMIER
056d59824f [PhpUnitBridge] Fix some errors when using serialized deprecations 2020-02-04 15:16:53 +01:00
Pchol
bbf7421a92 [SecurityBundle] add "service" option in remember_me firewall 2020-02-04 15:05:46 +01:00
TimiTao
22e59f31be [Messenger] fix support for abstract handlers 2020-02-04 14:57:29 +01:00
Fabien Potencier
a66b645681 feature #31466 [Validator] add Validation::createCallable() (janvernieuwe)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Validator] add Validation::createCallable()

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This is an initial PR to check/discuss the implementation of a callable validator.
If there is interest in merging this, I will gladly update the docs and such.

The use case is mainly for validation of console questions, since the default validation has been removed in the latest version and i could not find an easy solution to replace it (if there already is some solution for this, i'm not aware of it) and the question helper uses callables.
This small class allows the standard symfony validators to be used in console questions, or any other location that requires a callable validator.

Example use case:
```php
$io = new SymfonyStyle($input, $output);
$required = new CallableValidator([new NotBlank()]);
$wsdl = $io->ask('Wsdl location (URL or path to file)', null, $required);
```

As said before, this is by no means the final version, but I would like to know if there is interest  in merging this (and receive some feedback about the implementation) before I put any more effort into this.

Commits
-------

2e4f2ac322 [Validator] add Validation::createCallable()
2020-02-04 14:38:26 +01:00
Fabien Potencier
753d4a2639 feature #34747 [Notifier] Added possibility to extract path from provided DSN (espectrio)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Added possibility to extract path from provided DSN

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

I'm currently working on Microsoft Teams Webhook Notifier (https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook), and there is no way to provide DSN for it, because of missing parse_url()['path'] option

It looks like
`teams://outlook.office.com/webhook/{uuid}@{uuid}/IncomingWebhook/{id}/{uuid}`
and I'd like to be able to build Notifier Transport endpoint from it

Commits
-------

ab9b49b5c6 [Notifier] Added possibility to extract path from provided DSN
2020-02-04 14:19:51 +01:00
Fabien Potencier
626999c47f feature #35534 [FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase (adrienfr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase

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

Since 4.4, we have new PHPUnit constraints for the mailer component, but these are only available with `WebTestCase` and not `KernelTestCase`. I think this would be useful to access these constraints from both TestCase.

I don't know if I should move these [tests](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php) or add new ones only for `KernelTestCase`?

Commits
-------

1b1ab2991a [FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase
2020-02-04 14:16:01 +01:00
Fabien Potencier
7a4637eef9 feature #35590 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement

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

No need to configure the same requirements for `_locale` in all routes any more thanks to the `framework.translator.enabled_locales` config option introduced in #32433.

Commits
-------

5eebd37625 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement
2020-02-04 14:14:04 +01:00
Nicolas Grekas
5eebd37625 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement 2020-02-04 14:13:19 +01:00
Fabien Potencier
c8725bf198 feature #35167 [Notifier] Remove superfluous parameters in *Message::fromNotification() (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Remove superfluous parameters in *Message::fromNotification()

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

Those classes are final so I think we don't need those extra arguments.

Commits
-------

d0dacf51e1 [Notifier] Remove superfluous parameters in *Message::fromNotification()
2020-02-04 14:11:37 +01:00
Grégoire Pineau
0c499c6b35 Extracted code to expand an URI to UriExpanderTrait 2020-02-04 14:03:49 +01:00
Jérémy Derussé
c226479d5f
[Messenger] Add SQS transport 2020-02-04 11:49:33 +01:00
Fabien Potencier
ef30ef55d0 Fix CS 2020-02-04 11:45:13 +01:00
Fabien Potencier
e3fa80a514 feature #35485 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY (dunglas)
This PR was squashed before being merged into the 5.1-dev branch (closes #35485).

Discussion
----------

[Messenger] Add support for PostgreSQL LISTEN/NOTIFY

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

PostgreSQL comes with a builtin, performant, scalable and transactional pub/sub system called [`LISTEN`/`NOTIFY`](https://www.postgresql.org/docs/current/sql-notify.html).
This PR allows to leverage this mechanism when using the Messenger component with Postgres.

When the Postgres is used, workers are notified in real-time when a message is dispatched.
This reduces the latency, and prevents the worker from executing useless SQL queries. Basically, it allows to switch from a polling-based approach to an event-based one.

This patch can be used with all existing installation of Messenger, as long as the underlying DBMS is Postgres. For many (most ?) projects, it allows to get the benefits of using a queue system such as RabbitMQ or Pulsar without having to introduce new services to monitor, replicate or upgrade.

If PostgreSQL is used, `LISTEN`/`NOTIFY` is used automatically!

That's all!

It's also possible to configure how long the worker must wait for new messages:

```yaml
framework:
    messenger:
        transports:
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    pgsql_get_notify: true
                    pgsql_get_notify_timeout: 500
```

Then you can use start the workers with something like: `php bin/console messenger:consume --sleep=0`

A demo app using this new feature is available in this repository: https://github.com/dunglas/demo-postgres-listen-notify

TODO:

* [ ] Add tests

Commits
-------

01f33c3ab5 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY
2020-02-04 11:44:36 +01:00
Kévin Dunglas
01f33c3ab5 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY 2020-02-04 11:42:42 +01:00
Fabien Potencier
3750988c42 bug #35553 Fix HTTP client config handling (julienfalque)
This PR was merged into the 4.4 branch.

Discussion
----------

Fix HTTP client config handling

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

Defining a `key` parameter in the `query` option of a scoped HTTP client triggers an error:
```
Undefined index: value
```
This PR fixes this issue but an edge case still remains with YAML and PHP config. If one wants to define parameters `key=foo`, `value=bar` and nothing else, the query will actually be `foo=bar` instead of `key=foo&value=bar`. Not sure how to fix this case without breaking the tests I added here.

Commits
-------

963d0cce86 Fix HTTP client config handling
2020-02-04 11:40:26 +01:00
Fabien Potencier
9613f84df5 minor #35589 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call (chalasr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Mailer] Fix MandrillHttpTransport::getRecipients()'s call

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

Should make the CI green.

Commits
-------

f88d1bb328 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call
2020-02-04 11:37:49 +01:00
Fabien Potencier
cf9f5a071c feature #32039 [Cache] Add couchbase cache adapter (ajcerezo)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Cache] Add couchbase cache adapter

| Q             | A
| ------------- | ---
| Branch?       | 4.4 for features
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/32038
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/11748

Add new cache adapter to be able using Couchbase as cache system.

Commits
-------

1ae7dd5ec7 [Cache] Add couchbase cache adapter
2020-02-04 11:36:41 +01:00
Antonio José Cerezo Aranda
1ae7dd5ec7 [Cache] Add couchbase cache adapter 2020-02-04 11:32:31 +01:00
Nicolas Grekas
1e2b88f43e Merge branch '5.0'
* 5.0:
  cs fix
  Escape variable in Exception Template
2020-02-04 11:31:29 +01:00
Nicolas Grekas
244c347178 Merge branch '4.4' into 5.0
* 4.4:
  Escape variable in Exception Template
2020-02-04 11:31:13 +01:00
Robin Chalas
f88d1bb328 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call 2020-02-04 11:29:55 +01:00
Fabien Potencier
eaec5d67ae bug #35588 [ErrorHandler] Escape variable in Exception template (jderusse)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Escape variable in Exception template

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

Commits
-------

629d21b800 Escape variable in Exception Template
2020-02-04 11:28:16 +01:00
Nicolas Grekas
6b18e7007a Merge branch '4.4' into 5.0
* 4.4:
  cs fix
2020-02-04 11:22:37 +01:00
Nicolas Grekas
f312e3cda6 Merge branch '3.4' into 4.4
* 3.4:
  cs fix
2020-02-04 11:21:54 +01:00
Fabien Potencier
f23aa969f4 feature #32433 [Translation] Introduce a way to configure the enabled locales (javiereguiluz)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Translation] Introduce a way to configure the enabled locales

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #31563
| License       | MIT
| Doc PR        | -

This implements the idea #31563 so we can decide if we want to add this or not. I tested it in the "Symfony Demo" app. Before: 107 catalogs created in cache/dev/translations/. After: 43 catalogs. But that's because the app is translated into lots of languages. In most cases, only 2 catalog files will be generated (vs 107 before).

If this idea is approved, I'll add tests and docs. Thanks.

Commits
-------

765843426e [Translation] Introduce a way to configure the enabled locales
2020-02-04 11:12:18 +01:00
Fabien Potencier
61774e6c07 Fix CS 2020-02-04 11:11:53 +01:00
Fabien Potencier
a416a66416 Fix bad merge 2020-02-04 11:11:20 +01:00
Fabien Potencier
a841a3e52c Fix CS 2020-02-04 11:10:55 +01:00
Fabien Potencier
2f5047ea3d Merge branch '5.0'
* 5.0:
  Fix bad merge
2020-02-04 11:03:49 +01:00
Fabien Potencier
a196d0571d Fix bad merge 2020-02-04 11:03:41 +01:00
Nicolas Grekas
c2e0aab7be cs fix 2020-02-04 10:59:34 +01:00
Javier Eguiluz
765843426e [Translation] Introduce a way to configure the enabled locales 2020-02-04 10:57:06 +01:00
Jérémy Derussé
629d21b800
Escape variable in Exception Template 2020-02-04 10:53:50 +01:00
Fabien Potencier
d5bbdca755 Merge branch '5.0'
* 5.0:
  Fix CS
  Fix CS
  Fix CS
2020-02-04 10:50:54 +01:00
Fabien Potencier
f64f59a9c0 Fix CS 2020-02-04 10:47:34 +01:00
Fabien Potencier
bb4e394949 Merge branch '4.4' into 5.0
* 4.4:
  Fix CS
  Fix CS
2020-02-04 10:41:09 +01:00
Fabien Potencier
de8348a033 Fix CS 2020-02-04 10:32:40 +01:00
Fabien Potencier
3ee39e7468 Merge branch '3.4' into 4.4
* 3.4:
  Fix CS
2020-02-04 10:01:01 +01:00
Jon Dufresne
ef1206964e [Filesystem] Add $suffix argument to tempnam()
Fixes #33002
2020-02-04 09:09:47 +01:00
Fabien Potencier
a3e49f30c7 Fix CS 2020-02-04 09:04:52 +01:00
Nicolas Grekas
8e22719130 feature #35347 [VarDumper] Add a RdKafka caster (romainneutron)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[VarDumper] Add a RdKafka caster

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

Hello,

This is the very beginning of this new feature.
First, I'd like to know if there's a no-go for this feature so I won't waste my time.
Then, if you are a RdKafka expert, I'd take your comments with much pleasure sincer I'm a noob in this technology (and that's why I'm implementing this caster 🤓)
Tests need to be added once the implementation will be a bit more complete.

Commits
-------

6cd1235539 Add a RdKafka caster to Var-Dumper
2020-02-04 09:00:51 +01:00
Romain Neutron
6cd1235539
Add a RdKafka caster to Var-Dumper 2020-02-04 08:53:38 +01:00
Fabien Potencier
c6d0a2a10e Merge branch '5.0'
* 5.0:
  Add missing use statements
  [Translation] Add missing use statement
  [Translation] Add missing use statement
  [Config][XmlReferenceDumper] Prevent potential \TypeError
  [Mailer] Fix broken mandrill http send for recipients with names
  [Translation] prefer intl domain when adding messages to catalogue
  Fix CS
  Fix CS
  Fail on empty password verification (without warning on any implementation)
  [Translation][Debug] Add installation and minimal example to README
  [Validator] try to call __get method if property is uninitialized
  Show both missing packages in the same error message
  Fix handling of empty_data's \Closure value in Date/Time form types
2020-02-04 08:41:44 +01:00
Fabien Potencier
85f793bec6 Merge branch '4.4' into 5.0
* 4.4:
  Add missing use statements
  [Translation] Add missing use statement
  [Translation] Add missing use statement
  [Config][XmlReferenceDumper] Prevent potential \TypeError
  [Mailer] Fix broken mandrill http send for recipients with names
  [Translation] prefer intl domain when adding messages to catalogue
  Fix CS
  Fix CS
  Fail on empty password verification (without warning on any implementation)
  [Translation][Debug] Add installation and minimal example to README
  [Validator] try to call __get method if property is uninitialized
  Show both missing packages in the same error message
  Fix handling of empty_data's \Closure value in Date/Time form types
2020-02-04 08:41:34 +01:00
Fabien Potencier
cb16fe7432 Merge branch '3.4' into 4.4
* 3.4:
  [Translation] Add missing use statement
  [Translation][Debug] Add installation and minimal example to README
  [Validator] try to call __get method if property is uninitialized
  Fix handling of empty_data's \Closure value in Date/Time form types
2020-02-04 08:40:16 +01:00
Fabien Potencier
cd27b9d06f Add missing use statements 2020-02-04 08:35:15 +01:00
Fabien Potencier
ce29631cd8 [Translation] Add missing use statement 2020-02-04 08:22:30 +01:00
Fabien Potencier
00baa290e8 [Translation] Add missing use statement 2020-02-04 08:15:38 +01:00
Nicolas PHILIPPE
bc4f7d701f Messenger: validate options for AMQP and Redis Connections 2020-02-04 06:52:48 +01:00
Smaine Milianni
e2e6bd0f3a [WebProfiler] Improve HttpClient Panel 2020-02-03 18:49:13 +01:00
Fabien Potencier
28eedb8cef bug #34123 [Form] Fix handling of empty_data's \Closure value in Date/Time form types (yceruto)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Fix handling of empty_data's \Closure value in Date/Time form types

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

Basically this would solve the posibility to pass a `\Closure` to the `empty_data` option for Date/Time form types.

> https://symfony.com/doc/current/reference/forms/types/form.html#empty-data
> If a form is compound, you can set empty_data as an array, object or **closure**. See the [How to Configure empty Data](https://symfony.com/doc/current/form/use_empty_data.html) for a Form Class article for more details about these options.

Also related to https://github.com/symfony/symfony/pull/29182

Commits
-------

4939f0e323 Fix handling of empty_data's \Closure value in Date/Time form types
2020-02-03 18:31:42 +01:00
Thomas Calvet
7bfc27e7cf [Form] Add "is empty callback" to form config 2020-02-03 18:27:57 +01:00