Commit Graph

30986 Commits

Author SHA1 Message Date
Johan de Ruijter
e2c7c3373d [Form] [Validator] Add failing testcase to demonstrate group sequence issue
When using group sequences on a form, sometimes constraints are ignored even though they should fail.
2020-10-02 11:43:30 +02:00
HypeMC
1f7f2c6ddc Allow multiple parts with the same name in FormDataPart 2020-10-02 11:11:56 +02:00
Nicolas Grekas
73ca97c97a Merge branch '5.1'
* 5.1:
  [HttpClient] fix using proxies with NativeHttpClient
  [4.4] Ignore more deprecations for Mockery mocks
  [Routing] fix using !important and defaults/reqs in inline route definitions
  [ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes
  [HttpClient] Fix using https with proxies
  [TwigBundle] Only remove kernel exception listener if twig is used
  [DI] Fix changelog
  Remove CHANGELOG files for 4.x
  Adjust expired range check
  Fix redis connection error message
  [DI] fix dumping non-shared lazy services
2020-10-02 10:56:13 +02:00
Nicolas Grekas
d8255138ae Merge branch '4.4' into 5.1
* 4.4:
  [HttpClient] fix using proxies with NativeHttpClient
  [4.4] Ignore more deprecations for Mockery mocks
  [Routing] fix using !important and defaults/reqs in inline route definitions
  [ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes
  [HttpClient] Fix using https with proxies
  [TwigBundle] Only remove kernel exception listener if twig is used
  Adjust expired range check
  Fix redis connection error message
2020-10-02 10:49:02 +02:00
Nicolas Grekas
0d8721fc01 Merge branch '3.4' into 4.4
* 3.4:
  Adjust expired range check
2020-10-02 10:38:15 +02:00
Nicolas Grekas
3cfd991ae6 bug #38377 [4.4] Ignore more deprecations for Mockery mocks (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[4.4] Ignore more deprecations for Mockery mocks

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

Commits
-------

1a801e8452 [4.4] Ignore more deprecations for Mockery mocks
2020-10-02 10:36:26 +02:00
Nicolas Grekas
aca260fbd0 bug #38375 [HttpClient] fix using proxies with NativeHttpClient (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix using proxies with NativeHttpClient

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

As spotted by @stof in https://github.com/symfony/symfony/pull/38368#issuecomment-702272737, we cannot use local DNS resolution with HTTP proxies.

Commits
-------

28f301bf03 [HttpClient] fix using proxies with NativeHttpClient
2020-10-02 10:29:59 +02:00
Nicolas Grekas
9c8a3009cf bug #38372 [Routing] fix using !important and defaults/reqs in inline route definitions (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing] fix using !important and defaults/reqs in inline route definitions

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

Commits
-------

826db225b7 [Routing] fix using !important and defaults/reqs in inline route definitions
2020-10-02 10:22:10 +02:00
Nicolas Grekas
28f301bf03 [HttpClient] fix using proxies with NativeHttpClient 2020-10-02 10:17:19 +02:00
Thomas Calvet
1a801e8452 [4.4] Ignore more deprecations for Mockery mocks 2020-10-02 09:34:48 +02:00
Fabien Potencier
d0ded920e6 bug #38367 [RateLimiter] Fix cache storage (use namespaced pool + remove \Serializable) (wouterj)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[RateLimiter] Fix cache storage (use namespaced pool + remove \Serializable)

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

Commits
-------

251c202874 Use a dedicated cache.rate_limiter cache pool
5dc562a318 Use __sleep/__wakeup instead of Serializable
2020-10-02 08:02:03 +02:00
Fabien Potencier
67a7be2bd0 Fix CS 2020-10-02 07:59:23 +02:00
Fabien Potencier
954009a4d7 feature #32904 [Messenger] Added ErrorDetailsStamp (TimoBakx)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Messenger] Added ErrorDetailsStamp

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32311
| License       | MIT
| Doc PR        | No doc changes are needed

#SymfonyHackday

This PR is part of the work started in #32341. That PR has a workaround for showing exceptions added to a previous retry. This PR stores error messages in a separate stamp, so they're more easily accessed.

I also added the exceptionClass as a separate string (independant of FlattenException), so that information is always available, even if the trace is not (due to FlattenException not being available).

Duplicated exceptions (compared to the last one) are not stored separately.

**Questions:**
- Should we limit the total amount of exceptions (remove the oldest when adding a new one)?
  - Yes, but in a new PR
- The current implementation adds this stamp in the Worker instead of the listeners to prevent duplicate code (due to the immutability of the envelope in the event). Is this the proper way to do this?
  - No, create a new listener and a way to add stamps to the envelope inside the event.
- When adding details of a `HandlerFailedException`, should we add a stamp per wrapped `Throwable`? There can be multiple errors wrapped by a single `HandlerFailedException`.
  - Yes, but in a later PR

**Todo:**
- [x] only add new information if it differs from the previous exception
- [x] add deprecations
- [x] fall back to old stamp data if no new stamp is available
- [x] rebase and retarget to master
- [x] update CHANGELOG.md
- [x] check for docs PR

**BC Breaks:**
When this PR is merged, RedeliveryStamps will no longer be populated with exception data. Any implementations that use `RedeliveryStamp::getExceptionMessage()` or `RedeliveryStamp::getFlattenedException()` will receive an empty string or `null` respectively for stamps added after this update. They should rely on `ErrorDetailsStamp` instead.

**New stuff:**
- New stamp `ErrorDetailsStamp`.
- New event subscriber `AddErrorDetailsStampListener`.
- New method `AbstractWorkerMessageEvent::addStamps`.

Commits
-------

cd27b863f9 [Messenger] Added FailedMessageErrorDetailsStamp
2020-10-02 07:56:41 +02:00
Fabien Potencier
14942dbbe8 feature #36152 [Messenger] dispatch event when a message is retried (nikophil)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Messenger] dispatch event when a message is retried

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

Hello,

i'm working on a bundle which helps to monitor messenger queues (add some stats for queues/transports + ability to manage failed messages from the browser)
https://github.com/SymfonyCasts/messenger-monitor-bundle/

and we're missing some hooks in the messaging system:
1. a way to know when a message has been retried (fixed by dispatching a new `WorkerMessageRetriedEvent` in `SendFailedMessageForRetryListener::onMessageFailed()`)
2. a way to update the enveloppe in worker message events (fixed by adding `AbstractWorkerMessageEvent::setEnvelope()`)

if needed i can provide some precise use cases.

thanks.

Commits
-------

55bddcb721 [Messenger] dispatch event when a message is retried
2020-10-02 07:48:00 +02:00
Nicolas PHILIPPE
55bddcb721 [Messenger] dispatch event when a message is retried 2020-10-02 07:47:55 +02:00
Olivier Dolbeau
09c9bde479 Can define ChatMessage transport to null 2020-10-02 07:42:01 +02:00
Fabien Potencier
b35bbdbde5 feature #38289 [HttpClient] provide response body to the RetryDecider (jderusse)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] provide response body to the RetryDecider

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | yes but for not-yet released 5.2 feature
| Tickets       | /
| License       | MIT
| Doc PR        | TODO

Some servers, like AWS, does not always return standard HTTP code. The strategy needs to parse the body to take a decision.
example:
```
400
x-amzn-requestid: XXXXX
content-type: application/x-amz-json-1.1
content-length: 58
date: Thu, 24 Sep 2020 11:17:35 GMT
connection: close

{"__type":"ThrottlingException","message":"Rate exceeded"}
````

This PR update the `RetryDeciderInterface` interface to let the decider notifying the Client when it need the body to take a decision. in that case, the Client, fetch te client, and call again the decider with the full body.

usage
```php
class Decider implements RetryDeciderInterface {
    public function shouldRetry(string $requestMethod, string $requestUrl, array $requestOptions, int $responseCode, array $responseHeaders, ?string $responseContent, \Throwable $throwable = null): ?bool
    {
        if (null !== $throwable) {
            return true;
        }
        if (in_array($responseCode, [423, 425, 429, 500, 502, 503, 504, 507, 510])) {
            return true;
        }
        if (
            $responseCode !== 400
            || $headers['content-type'][0] ?? null !== 'application/x-amz-json-1.1'
            || (int) $headers['content-length'][0] ?? '0' > 1024
        ) {
            return false;
        }
        if (null === $responseContent) {
            return null; // null mean no decision taken and need to be called again with the body
        }

        $data = json_decode($responseContent, true);

        return $data['__type'] ?? '' === 'ThrottlingException';
    }
}
```

Commits
-------

321be5884d [HttpClient] provide response body to the RetryDecider
2020-10-02 07:36:08 +02:00
Kevin Bond
a7ecd0ed08
[RateLimiter] add Limit::ensureAccepted() and RateLimitExceededException 2020-10-01 20:04:22 -04:00
Nicolas Grekas
826db225b7 [Routing] fix using !important and defaults/reqs in inline route definitions 2020-10-01 18:25:17 +02:00
Thomas Calvet
bbd12fe27f [ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes 2020-10-01 18:21:20 +02:00
Bohan Yang
7e0cd4e621 [HttpClient] Fix using https with proxies 2020-10-01 18:05:21 +02:00
Jérémy Derussé
321be5884d
[HttpClient] provide response body to the RetryDecider 2020-10-01 17:55:44 +02:00
Timo Bakx
cd27b863f9 [Messenger] Added FailedMessageErrorDetailsStamp 2020-10-01 16:25:39 +02:00
Wouter de Jong
5dc562a318 Use __sleep/__wakeup instead of Serializable
Fixes #38338
2020-10-01 14:20:33 +02:00
Roland Franssen
d784b50da3
[DI] Fix changelog 2020-10-01 14:14:45 +02:00
Fabien Potencier
1b6894781c bug #38360 [BrowserKit] Cookie expiration at current timestamp (iquito)
This PR was merged into the 3.4 branch.

Discussion
----------

[BrowserKit] Cookie expiration at current timestamp

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

In `Symfony\Component\BrowserKit\Cookie` a cookie is expired if the `expires` timestamp is in the past. I would like to change it to also be expired if the `expires` timestamp equals the current exact timestamp. This would still be in line with [RFC 6265](https://tools.ietf.org/html/rfc6265#section-4.1.2.1), as it states `The Expires attribute indicates the maximum lifetime of the cookie, represented as the date and time at which the cookie expires`.

Reason for this change: Cookies usually both have `expires` and `Max-Age` set, and Symfony sets `Max-Age` to zero if a cookie is expired (in `Symfony\Component\HttpFoundation\Cookie`). When converting cookies between string and object representations, `Max-Age` is the preferred source of truth for the expiration, but `Max-Age` set to zero is converted to an `expires` timestamp at this exact second, currently making the cookie not expired in `Symfony\Component\BrowserKit\Cookie`, even though it should be.

I noticed this discrepancy in my tests when checking if a cookie no longer existed after deleting it, yet it was still there, because `Cookie` thought it would only expire after the `expires` timestamp had passed. I am also thinking of raising an issue for `Symfony\Component\HttpFoundation\Cookie`, as importing and exporting an expired cookie (via strings) changes the `expired` value. I thought this change was a simpler one for now, and should have no negative/unexpected impact.

Commits
-------

9d187c0d1a Adjust expired range check
2020-10-01 12:44:36 +02:00
Andreas
9d187c0d1a Adjust expired range check
Include current second when deciding if cooke has expired.
2020-10-01 12:06:12 +02:00
Fabien Potencier
127724d519 feature #38308 [Security][RateLimiter] Added request rate limiter to prevent breadth-first attacks (wouterj)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Security][RateLimiter] Added request rate limiter to prevent breadth-first attacks

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

This allows limiting on different elements of a request. The normal `CompoundLimiter` requires the same key for all its limiters.

This request limiter is useful to e.g. prevent breadth-first attacks, by allowing to enforce a limit on both IP and IP+username. It can also be useful for applications using some sort of API request limiting (or e.g. file upload limiting).

The default login throttling limiter will allow `max_attempts` (default: 5) attempts per minute for `username + IP` and `5 * max_attempts` for `IP`. Customizing this will require creating a new service that extends `AbstractRequestRateLimiter` and implementing `getLimiters(Request $request): LimiterInterface[]`.

Commits
-------

5d03afea99 Added request rate limiters and improved login throttling
2020-10-01 08:42:40 +02:00
Robin Chalas
e8dd14ac9e bug #38351 [Console] clone stream on multiline questions so EOT doesn't close input (ramsey)
This PR was squashed before being merged into the 5.2-dev branch (closes #38351).

Discussion
----------

[Console] clone stream on multiline questions so EOT doesn't close input

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

This fixes a bug in the multiline question feature that was introduced in #37683.

Today, @epitre commented on https://github.com/symfony/symfony/pull/37683#issuecomment-700666826:

> If I ask a question AFTER using the multiline option in a previous question, then it seems that the ctrl+d is kind of saved, and the command gets aborted.

I'm honestly not sure how I missed this while working on #37683, since I was testing it with multiple questions, but I think it might have resulted from some of the back-and-forth and the lack of ability to effectively test the EOT character from a unit test.

The solution was to _clone_ the input stream resource and use the clone to read the multiline input and capture the EOT byte. In this way, the primary input stream is not closed by the EOT.

This is similar to @epitre's solution in https://github.com/symfony/symfony/pull/38345, but I'm using the `uri` and `mode` from `stream_get_meta_data()` to create the new stream, and if the existing stream has any data and is seekable and writable (like the streams used in the tests), I add the data to the clone and seek to the same offset.

I've ensured that this solution works on a question that is in the middle of a series of other questions, and I've tested in on *nix and Windows. I've also improved the tests for multiline questions. While I'm unable to test (with a unit test) that an EOT character effectively stops reading from STDIN while continuing to the next question and prompt, I feel confident that the tests here provide sufficient coverage.

Commits
-------

ec688a361e [Console] clone stream on multiline questions so EOT doesn't close input
2020-09-30 21:48:20 +02:00
Ben Ramsey
ec688a361e [Console] clone stream on multiline questions so EOT doesn't close input 2020-09-30 21:34:12 +02:00
Wouter de Jong
5d03afea99 Added request rate limiters and improved login throttling
This allows limiting on different elements of a request. This is usefull to
e.g. prevent breadth-first attacks, by allowing to enforce a limit on both IP
and IP+username.
2020-09-30 21:18:40 +02:00
Alexander Schranz
f4e42ad3d4 Fix redis connection error message
Use correct instance of redis to getLastError
2020-09-30 18:06:18 +02:00
Nicolas Grekas
e33a0b0f94 [DI] fix dumping non-shared lazy services 2020-09-30 17:55:21 +02:00
Wouter de Jong
0279f88e6c Call all compound limiters on failure and added IO blocking 2020-09-30 12:14:20 +02:00
Fabien Potencier
aa661492d2 feature #38257 [RateLimiter] Add limit object on RateLimiter consume method (Valentin, vasilvestre)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[RateLimiter] Add limit object on RateLimiter consume method

| Q             | A
| ------------- | ---
| Branch?       | master (should be merged in 5.2 before 31 September if possible)
| 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 #38241
| License       | MIT
| Doc PR        | Not yet :/ <!-- https://github.com/symfony/symfony-docs/pull/X -->

Commits
-------

8f62afc5f9 [RateLimiter] Return Limit object on Consume method
2020-09-30 07:47:32 +02:00
Valentin
8f62afc5f9 [RateLimiter] Return Limit object on Consume method 2020-09-30 07:47:20 +02:00
Fabien Potencier
5eb442ec18 feature #38309 [Validator] Constraints as php 8 Attributes (derrabus)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Validator] Constraints as php 8 Attributes

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

This is my attempt to teach the validator to load constraints from PHP attributes. Like we've done it for the `Route` attribute, I've hooked into the existing `AnnotationLoader`, so we can again mix and match annotations and attributes.

### Named Arguments

An attribute declaration is basically a constructor call. This is why, in order to effectively use a constraint as attribute, we need to equip it with a constructor that works nicely with named arguments. This way, IDEs like PhpStorm can provide auto-completion and guide a developer when declaring a constraint without the need for additional plugins. Right now, PhpStorm supports neither attributes nor named arguments, but I expect those features to be implemented relatively soon.

To showcase this, I have migrated the `Range` and `Choice` constraints. The example presented in #38096 works with this PR.

```php
#[Assert\Choice(
    choices: ['fiction', 'non-fiction'],
    message: 'Choose a valid genre.',
)]
private $genre;
```

A nice side effect is that we get a more decent constructor call in php 8 in situations where we directly instantiate constraints, for instance when attaching constraints to a form field via the form builder.

```php
$builder->add('genre, TextType::class, [
    'constraints' => [new Assert\Choice(
        choices: ['fiction', 'non-fiction'],
        message: 'Choose a valid genre.',
    )],
]);
```

The downside is that all those constructors generate the need for some boilerplate code that was previously abstracted away by the `Constraint` class.

The alternative to named arguments would be leaving the constructors as they are. That would basically mean that when declaring a constraint we would have to emulate the array that Doctrine annotations would crate. We would lose IDE support and the declarations would be uglier, but it would work.

```php
#[Assert\Choice([
    'choices' => ['fiction', 'non-fiction'],
    'message' => 'Choose a valid genre.',
])]
private $genre;
```

### Nested Attributes

PHP does not support nesting attributes (yet?). This is why I could not recreate composite annotations like `All` and `Collection`. I think it's okay if they're not included in the first iteration of attribute constraints and we can work on a solution in a later PR. Possible options:
* A later PHP 8.x release might give us nested attributes.
* We could find a way to flatten those constraints so we can recreate them without nesting.
* We could come up with a convention for a structure that lets us emulate nested attributes in userland.

### Repeatable attributes

In order to attach two instances of the same attribute class to an element, we explicitly have to allow repetition via the flag `Attribute::IS_REPEATABLE`. While we could argue if it really makes sense to do this for certain constraints (like `NotNull` for instance), there are others (like `Callback`) where having two instances with different configurations could make sense. On the other hand, the validator certainly won't break if we repeat any of the constraints and all other ways to configure constraints allow repetition. This is why I decided to allow repetition for all constraints I've marked as attributes in this PR and propose to continue with that practice for all other constraints.

### Migration Path

This PR only migrates a handful of constraints. My plan is to discuss the general idea with this PR first and use it as a blueprint to migrate the individual constraints afterwards. Right now, the migration path would look like this:

* Attach the `#[Attribute]` attribute.
* Recreate all options of the constraint as constructor arguments.
* Add test cases for constructor calls with named arguments to the test class of the constraint's validator.

Commits
-------

d1cb2d6354 [Validator] Constraints as php 8 Attributes.
2020-09-30 07:35:13 +02:00
Fabien Potencier
dbedd284f4 minor #38315 [Notifier] Add Dsn test case (jschaedl)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Notifier] Add Dsn test case

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

6a0510d859 Add Dsn test case
2020-09-30 07:33:36 +02:00
Rodrigo Aguilera
c451c48258 [Console] Improve description for the help flag. 2020-09-30 07:13:00 +02:00
Alexander M. Turek
d1cb2d6354 [Validator] Constraints as php 8 Attributes. 2020-09-30 00:43:35 +02:00
Nicolas Grekas
55c17e1af7 [Validator] Add support for UUIDv6 in Uuid constraint 2020-09-29 08:56:19 +02:00
Fabien Potencier
d5ce0e3bc9 feature #38330 [Contracts] add TranslatableInterface (nicolas-grekas)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Contracts] add TranslatableInterface

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

An alternative to #38328:

- `TranslatableInterface` is added to symfony/contracts;
- `Translatable`, still in the component, implements it (and is not final as it makes no sense for a value-object)
- the `t()` function is kept in the component - it doesn't fit in the contracts IMHO;
- `Translatable::trans()` is not static anymore;
- the domain is nullable instead of defaulting to "messages";
- the `t()` function moved in the `Symfony\Component\Translation` namespace (for reference, the `s()` function from String is also namespaced.);
- the Twig extension is made strictly polymorphic: if you pass a Translatable, you cannot pass arguments/domain/count.

Commits
-------

9224f7ac5b [Contracts] add TranslatableInterface
2020-09-29 08:51:20 +02:00
Fabien Potencier
e159dff938 feature #38322 [Validator] Add Ulid constraint and validator (Laurent Clouet)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Validator] Add Ulid constraint and validator

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

ULID constraint and validator as mentioned in ticket #38103
I checked for it ulid specifications https://github.com/ulid/spec

Commits
-------

e36fd559da [Validator] Add Ulid constraint and validator
2020-09-29 08:36:34 +02:00
Laurent Clouet
e36fd559da [Validator] Add Ulid constraint and validator 2020-09-29 08:36:29 +02:00
Fabien Potencier
3113fce1df feature #38333 [Uid] make UUIDv6 always return truly random nodes to prevent leaking the MAC of the host (nicolas-grekas)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Uid] make UUIDv6 always return truly random nodes to prevent leaking the MAC of the host

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

As explained in http://gh.peabody.io/uuidv6/, the wording of the UUIDv1 spec suggests that using the MAC of the host is preferred to compute the "node" field of UUIDs. This is what the uuid extension does, and the reason why the 12 last chars of the UUIDv1 it generates are stable. But this is a privacy leak. There are stories in the wild about how knowing the MAC has been abused in the past.

UUIDv6 prefers putting a secure random number there.

So here is the PR to do so.

Commits
-------

b9c61ca86c [Uid] make UUIDv6 always return truly random nodes to prevent leaking the MAC of the host
2020-09-29 08:35:35 +02:00
Nicolas Grekas
b9c61ca86c [Uid] make UUIDv6 always return truly random nodes to prevent leaking the MAC of the host 2020-09-29 08:01:16 +02:00
Nicolas Grekas
9224f7ac5b [Contracts] add TranslatableInterface 2020-09-28 15:05:58 +02:00
Jérémy Derussé
7a80e41cd8
Fix non-blocking store fallback 2020-09-28 12:11:42 +02:00
Nicolas Grekas
6349a1b2fc Merge branch '5.1'
* 5.1:
  [HttpFoundation] skip tests when the IANA server is throttling the list of status codes
  [DoctrineBridge] fix DBAL v3 compat
2020-09-27 16:15:50 +02:00
Nicolas Grekas
66758ad5dc Merge branch '4.4' into 5.1
* 4.4:
  [HttpFoundation] skip tests when the IANA server is throttling the list of status codes
  [DoctrineBridge] fix DBAL v3 compat
2020-09-27 16:14:57 +02:00
Nicolas Grekas
cbb0b1d54b Merge branch '3.4' into 4.4
* 3.4:
  [HttpFoundation] skip tests when the IANA server is throttling the list of status codes
  [DoctrineBridge] fix DBAL v3 compat
2020-09-27 16:14:06 +02:00
Nicolas Grekas
feaa9a6b2a [HttpFoundation] skip tests when the IANA server is throttling the list of status codes 2020-09-27 16:13:16 +02:00
Nicolas Grekas
cde8ffecce Merge branch '5.1'
* 5.1:
  [Filesystem] fix for PHP 8
  [Cache] fix DBAL v3 compat
  Bump Symfony version to 5.1.7
  Update VERSION for 5.1.6
  Update CHANGELOG for 5.1.6
  Bump Symfony version to 4.4.15
  Update VERSION for 4.4.14
  Update CHANGELOG for 4.4.14
  Bump Symfony version to 3.4.46
  Update VERSION for 3.4.45
  Update CONTRIBUTORS for 3.4.45
  Update CHANGELOG for 3.4.45
2020-09-27 16:05:32 +02:00
Nicolas Grekas
b93dea7244 Merge branch '4.4' into 5.1
* 4.4:
  [Filesystem] fix for PHP 8
  [Cache] fix DBAL v3 compat
  Bump Symfony version to 4.4.15
  Update VERSION for 4.4.14
  Update CHANGELOG for 4.4.14
  Bump Symfony version to 3.4.46
  Update VERSION for 3.4.45
  Update CONTRIBUTORS for 3.4.45
  Update CHANGELOG for 3.4.45
2020-09-27 16:02:37 +02:00
Nicolas Grekas
7529d131cc Merge branch '3.4' into 4.4
* 3.4:
  [Filesystem] fix for PHP 8
2020-09-27 15:54:16 +02:00
Nicolas Grekas
a4324447f1 [Filesystem] fix for PHP 8 2020-09-27 15:07:29 +02:00
Jan Schädlich
6a0510d859 Add Dsn test case 2020-09-27 14:45:53 +02:00
Nicolas Grekas
911e120fa4 Merge branch '3.4' into 4.4
* 3.4:
  [Cache] fix DBAL v3 compat
  Bump Symfony version to 3.4.46
  Update VERSION for 3.4.45
  Update CONTRIBUTORS for 3.4.45
  Update CHANGELOG for 3.4.45
2020-09-27 14:40:39 +02:00
Nicolas Grekas
3d1ed2e90d [Cache] fix DBAL v3 compat 2020-09-27 14:33:10 +02:00
Jonas Hünig
91a44524ff [HttpFoundation][Cache][Messenger] Replace redis "DEL" commands with "UNLINK" 2020-09-27 12:41:29 +02:00
Fabien Potencier
176262b3b9 Bump Symfony version to 5.1.7 2020-09-27 06:36:47 +02:00
Fabien Potencier
81bcd90f08 Update VERSION for 5.1.6 2020-09-27 06:33:19 +02:00
Fabien Potencier
08e27e9f03 Bump Symfony version to 4.4.15 2020-09-27 06:29:46 +02:00
Fabien Potencier
9e8f2e7db6 Update VERSION for 4.4.14 2020-09-27 06:25:44 +02:00
Fabien Potencier
2abc465335 Merge branch '5.1'
* 5.1:
  Fix wrong merge
2020-09-27 06:23:47 +02:00
Fabien Potencier
46e609b262 Fix wrong merge 2020-09-27 06:23:37 +02:00
Fabien Potencier
9a774ede48 Bump Symfony version to 3.4.46 2020-09-27 06:03:03 +02:00
Fabien Potencier
bc38373380 Update VERSION for 3.4.45 2020-09-27 05:46:58 +02:00
Fabien Potencier
6ca92258d7 Merge branch '5.1'
* 5.1:
  [ErrorHandler] Return false directly and remove unused variable
  [OptionsResolver] Assert that the error type is valid in deprecations test
  [OptionsResolver] Fix deprecation message access
  [HttpClient] Allow bearer token with colon
  [Form] Fix custom formats deprecation with HTML5 widgets
  [Translator] Optional Intl dependency
  [Contracts][Translation] Optional Intl dependency
  [ErrorHandler] Escape JSON encoded log context
  update missing translations arabic
  [Yaml] simplify the test
  fix test by letting mock throw the actual expected exception
2020-09-27 05:44:38 +02:00
Fabien Potencier
5685496974 Merge branch '4.4' into 5.1
* 4.4:
  [ErrorHandler] Return false directly and remove unused variable
  [OptionsResolver] Assert that the error type is valid in deprecations test
  [HttpClient] Allow bearer token with colon
  [Form] Fix custom formats deprecation with HTML5 widgets
  [Translator] Optional Intl dependency
  [Contracts][Translation] Optional Intl dependency
  [ErrorHandler] Escape JSON encoded log context
  update missing translations arabic
  [Yaml] simplify the test
  fix test by letting mock throw the actual expected exception
2020-09-27 05:44:28 +02:00
Fabien Potencier
55a450d827 Merge branch '3.4' into 4.4
* 3.4:
  update missing translations arabic
  [Yaml] simplify the test
  fix test by letting mock throw the actual expected exception
2020-09-27 05:36:23 +02:00
Fabien Potencier
a6aa08e166 feature #38296 [lock] Provides default implementation when store does not supports the behavior (jderusse)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[lock] Provides default implementation when store does not supports the behavior

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

All stores does not provide the same behaviors. Some are blocking, some allows shared Locks, ...
Issue is: When people use `lock` to use a behavior that is not supported by the store, they get an `UnsuportedException`, but they don't have any way to know if the store supports or not the behavior they want to use.

ie: when using the FrameworkBundle
```yaml
framework:
    lock: '%env(LOCK_DSN)%'
```
User (or bundle) can't use safely `$lock->acquire(true)` or `$lock->acquireRead()`.

Given it's very easy to provide an fallback implementation to those behavior, this PR
- use fallback implementation when store does not support the behavior
- deprecate the RetryTillSaveStore (not needed anymore)

Commits
-------

575b391b9b [lock] Provides default implementation when store does not supports the behavior
2020-09-27 05:25:42 +02:00
Jérémy Derussé
575b391b9b [lock] Provides default implementation when store does not supports the behavior 2020-09-27 05:25:36 +02:00
Fabien Potencier
934b125dff feature #38298 [Notifier] Add Sendinblue notifier. (ptondereau)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Notifier] Add Sendinblue notifier.

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

Add Sendinblue SMS notifier bridge.

Commits
-------

e7300a8580 Add Sendinblue notifier.
2020-09-27 05:14:32 +02:00
Pierre Tondereau
e7300a8580 Add Sendinblue notifier. 2020-09-26 11:58:00 +02:00
Fabien Potencier
9e4f511cbf Fix CS 2020-09-26 07:31:43 +02:00
Fabien Potencier
013bbcc23e minor #38303 [Messenger] Fix misleading comment about time-limit (sylfabre)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Messenger] Fix misleading comment about time-limit

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

The current explanation of the time-limit option of the `messenger:consume` command is misleading as it lets you think that this is an enforced hard limit.

For instance, you may think that a command started with `--time-limit=10` will stop once 10 seconds are elapsed, no matter what.

Actually, two things happen:
- Once 10 seconds have elapsed, then the worker won't receive and handle any other message
- The worker will keep running until the currently handled message is fully handled so it can last way longer than 10 seconds, then it will stop.

I'm not sure this is behavior is actually a bug or not, but the current documentation does not describe the current behavior

Commits
-------

21176646e9 [Messenger] Fix misleading comment about time-limit
2020-09-26 07:30:40 +02:00
Titouan Galopin
0ba206420e [Translation] Allow Translatable objects to be used as strings 2020-09-25 18:10:29 +02:00
Sylvain Fabre
21176646e9 [Messenger] Fix misleading comment about time-limit 2020-09-25 15:58:44 +02:00
Thomas Calvet
3933957d1a [ErrorHandler] Return false directly and remove unused variable 2020-09-25 10:51:35 +02:00
Thomas Calvet
926d18f2f9 [OptionsResolver] Assert that the error type is valid in deprecations test 2020-09-24 18:40:22 +02:00
Thomas Calvet
232af423aa [OptionsResolver] Fix deprecation message access 2020-09-24 18:12:55 +02:00
Fabien Potencier
2bdcf4ac8f feature #36326 [Validator] Add invalid datetime message in Range validator (przemyslaw-bogusz)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Validator] Add invalid datetime message in Range validator

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

When the validated value is invalid (it isn't a number nor a datetime), but `min` or `max` option indicate that the `Range` constraint is being used to validate a datetime, the displayed message will be `This value should be a valid datetime` instead of `This value should be a valid number`. This PR replaces #35998.

Commits
-------

c77730699e [Validator] Add invalid datetime message in Range validator
2020-09-24 16:49:32 +02:00
Przemysław Bogusz
c77730699e [Validator] Add invalid datetime message in Range validator 2020-09-24 16:49:16 +02:00
Fabien Potencier
59f712475b feature #38243 [HttpKernel] Auto-register kernel as an extension (HypeMC)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpKernel] Auto-register kernel as an extension

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

Symfony already supports having the kernel as an extension. This is evident by the fact that the [`config:dump-reference` and `debug:config`](https://github.com/symfony/symfony/pull/36186) commands check whether the kernel implements the `ExtensionInterface`. Nonetheless, it's still required to register the kernel manually as an extension.

With this PR the kernel will be automatically registered as an extension if it implements the `ExtensionInterface`. This is the same logic as when the kernel implements the `CompilerPassInterface`.

Commits
-------

9c34980869 Auto-register kernel as an extension
2020-09-24 16:31:11 +02:00
Fabien Potencier
5c48235e71 feature #38277 [Mailer] Added Sendinblue bridge (drixs6o9)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Mailer] Added Sendinblue bridge

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| License       | MIT
| Doc PR        | [https://github.com/symfony/symfony-docs/pull/14272](https://github.com/symfony/symfony-docs/pull/14272)
| Recipe | [https://github.com/symfony/recipes/pull/822](https://github.com/symfony/recipes/pull/822)

<!--
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.
-->

N.B. I had a little help from [Pierre TONDEREAU](https://github.com/ptondereau) for the API.

Commits
-------

836a20350b [Mailer] Added Sendinblue bridge
2020-09-24 16:10:39 +02:00
drixs6o9
836a20350b [Mailer] Added Sendinblue bridge 2020-09-24 16:10:25 +02:00
Fabien Potencier
6e9949b9b2 feature #35956 [Form] Added "html5" option to both MoneyType and PercentType (romaricdrigon)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Form] Added "html5" option to both MoneyType and PercentType

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

Hello,

In the same way that [NumberType](https://symfony.com/doc/current/reference/forms/types/number.html) offers a `html5` option to render a `number` input instead of a `text` input, this PR adds the same option to both `MoneyType` and `PercentType`. Number inputs offer a better UI, especially on mobile (specific keyboard), and they accept extra HTML attributes, such as `max=100`, which are quite useful.

The challenge is that `number` inputs need a "raw" value, nor formatted nor localized.
Format is described here https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats (non-normative, but tested on a few browsers). It matches number formatting for `en` locale (which is great, since it is the one provided by Symfony Intl polyflil), without grouping.

Implementation was done in a manner similar to `NumberType` for `MoneyType`.
`PercentType` required to modify `PercentToLocalizedStringTransformer` too.

As a bonus, `PercentType` had no tests at all, I added a few.

I wanted to get some feedback on the idea first, remaining steps:
 - update `CHANGELOG.md`
 - update the doc

Commits
-------

f7312a48ea [Form] Added "html5" option to both MoneyType and PercentType
2020-09-24 15:56:19 +02:00
Fabien Potencier
2e819f3ba9 Revert "feature #33381 [Form] dispatch submit events for disabled forms too (xabbuh)"
This reverts commit dc63d712ab, reversing
changes made to 59ae592909.
2020-09-24 15:50:42 +02:00
Romaric Drigon
f7312a48ea [Form] Added "html5" option to both MoneyType and PercentType 2020-09-24 15:48:47 +02:00
Nicolas Grekas
caab0f1b4f bug #38248 [HttpClient] Allow bearer token with colon (stephanvierkant)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[HttpClient] Allow bearer token with colon

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

The JetBrains Hub (YouTrack API) creates tokens with a `perm:` prefix. This doesn't work right now, because HttpClient doesn't allow a colon in the bearer token.

As far as I can see, there is no reason to disallow the use of the semicolon in the bearer token, so this PR fixes it.

Example of a token: `perm:c3RlcGhhbg==.NTUtMw==.NiZw16agafhsQAShTvclhb78hyJh2H`

Commits
-------

82ed1ec20a [HttpClient] Allow bearer token with colon
2020-09-24 15:25:52 +02:00
Stephan Vierkant
82ed1ec20a [HttpClient] Allow bearer token with colon 2020-09-24 15:25:24 +02:00
Fabien Potencier
9e7e2a87c9 bug #37837 [Form] Fix custom formats deprecation with HTML5 widgets (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[Form] Fix custom formats deprecation with HTML5 widgets

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

1. The options resolver only show the deprecations for user defined (overidden) options.
2. The default value of the `html5` option is enough to pass the logical condition of the callback.

That means that only setting the `format` option (like in the reproducer) does not trigger the deprecation while it should. I think we need a feature in the options resolver component to handle those kind of cases 🤷‍♂️

Meanwhile, we can fix the issue by "deprecating" all the concerned options of the logical condition of the callback.

Commits
-------

d28182f99b [Form] Fix custom formats deprecation with HTML5 widgets
2020-09-24 12:57:15 +02:00
Kevin Bond
f20a318f37 [String] allow passing null to string functions 2020-09-24 11:57:23 +02:00
Thomas Calvet
d28182f99b [Form] Fix custom formats deprecation with HTML5 widgets 2020-09-24 11:52:40 +02:00
Fabien Potencier
d9bcb64fc0 bug #38283 [Translator] Optional Intl dependency (ro0NL)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Translator] Optional Intl dependency

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38279
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- 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/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.
-->

i decided to cast $locale at construct, given its property is documented to be string

Commits
-------

a2eb263457 [Translator] Optional Intl dependency
2020-09-24 11:40:07 +02:00
Roland Franssen
a2eb263457 [Translator] Optional Intl dependency 2020-09-24 11:40:01 +02:00
Robin Chalas
02be26a39c bug #38271 [ErrorHandler] Escape JSON encoded log context (ro0NL)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Escape JSON encoded log context

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

Fixes https://github.com/symfony/symfony/issues/35569#issuecomment-581317792
Fixes https://github.com/symfony/symfony/issues/35569#issuecomment-696767559

The initial issue remains though (the webprofiler showing the logs tab in the exception panel), i'll try to give it another look sometime, but this is a quick win nevertheless.

cc @yceruto

Commits
-------

5572a68ed7 [ErrorHandler] Escape JSON encoded log context
2020-09-24 11:16:22 +02:00
Christian Flothmann
9323b75603 Merge branch '5.1' into master
* 5.1:
  fix compatibility with Doctrine DBAL 3
2020-09-24 10:13:58 +02:00
Christian Flothmann
79686c63ef Merge branch '4.4' into 5.1
* 4.4:
  fix compatibility with Doctrine DBAL 3
2020-09-24 09:56:38 +02:00
Christian Flothmann
a03885168e fix compatibility with Doctrine DBAL 3 2020-09-24 08:54:33 +02:00
Roland Franssen
5572a68ed7
[ErrorHandler] Escape JSON encoded log context 2020-09-22 18:24:16 +02:00
Fabien Potencier
7cb8ba585d Fix CS 2020-09-22 11:22:20 +02:00
Fabien Potencier
90056b871a feature #38176 [Config] Adding the "info" to a missing option error messages (weaverryan)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Config] Adding the "info" to a missing option error messages

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

New error:

<img width="1063" alt="Screen Shot 2020-09-13 at 10 51 32 AM" src="https://user-images.githubusercontent.com/121003/93021186-6329ff00-f5af-11ea-83c6-98581b12ef75.png">

I used the missing `class` just as an example. I hit this while building a new feature in Symfony. It occurred to me that if, for example, you activate some feature in config and that feature has a required sub-key, why not print the `info()` for that sub key to make it discoverable?

Commits
-------

3780f122c7 adding the description to a missing option
2020-09-22 11:20:33 +02:00
Zairig Imad
76a47b38e2 update missing translations arabic 2020-09-22 10:56:57 +02:00
Christian Flothmann
593a94c932 replace expectExceptionMessageRegExp() with expectExceptionMessageMatches() 2020-09-20 09:51:18 +02:00
Christian Flothmann
ccecffeff6 Merge branch '5.1' into master
* 5.1: (25 commits)
  stop using the deprecated at() PHPUnit matcher
  fix lowest allowed version of the HTTP client contracts
  fix lowest allowed version for the PHPUnit bridge
  fix merge
  fix merge
  drop logger mock in favor of using the BufferingLogger
  catch ValueError thrown on PHP 8
  [Yaml Parser] Fix edge cases when parsing multiple documents
  fix parsing comments not prefixed by a space
  [Translator] Make sure a null locale is handled properly
  deal with errors being thrown on PHP 8
  loadRoutes shoud receive RoutingPhpFileLoader
  [Cache] Allow cache tags to be objects implementing __toString()
  [HttpKernel] Do not override max_redirects option in HttpClientKernel
  Log notice when no entry point is configured
  remove superfluous cast
  [HttpClient] Support for CURLOPT_LOCALPORT.
  Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
  Fixed exception message formatting
  [FrameworkBundle] Fix error in xsd which prevent to register more than one metadata
  ...
2020-09-20 09:20:17 +02:00
HypeMC
9c34980869 Auto-register kernel as an extension 2020-09-20 02:47:54 +02:00
Christian Flothmann
2a76d51da5 minor #38238 [Validator] stop using the deprecated at() PHPUnit matcher (xabbuh)
This PR was merged into the 5.1 branch.

Discussion
----------

[Validator] stop using the deprecated at() PHPUnit matcher

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

Commits
-------

0d0f92b7c6 stop using the deprecated at() PHPUnit matcher
2020-09-18 20:37:45 +02:00
Christian Flothmann
0d0f92b7c6 stop using the deprecated at() PHPUnit matcher 2020-09-18 20:24:55 +02:00
Christian Flothmann
f88caa81da minor #38237 [HttpClient] fix lowest allowed version of the HTTP client contracts (xabbuh)
This PR was merged into the 5.1 branch.

Discussion
----------

[HttpClient] fix lowest allowed version of the HTTP client contracts

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

fixes `deps=low` builds for the HttpClient component by making sure that the installed version of the HTTP client contracts package contains the changes from #37831

Commits
-------

edca581889 fix lowest allowed version of the HTTP client contracts
2020-09-18 19:14:44 +02:00
Christian Flothmann
edca581889 fix lowest allowed version of the HTTP client contracts 2020-09-18 18:31:55 +02:00
Alexander M. Turek
34dbf01618 [VarDumper] Support for ReflectionAttribute. 2020-09-18 18:10:35 +02:00
Christian Flothmann
fb7ee79dba fix lowest allowed version for the PHPUnit bridge 2020-09-18 18:07:05 +02:00
Christian Flothmann
bb64fc9c3b [Yaml] simplify the test 2020-09-18 17:58:55 +02:00
Christian Flothmann
9610daf1bc fix merge 2020-09-18 17:39:40 +02:00
Christian Flothmann
4ee591bec6 Merge branch '4.4' into 5.1
* 4.4:
  fix merge
  drop logger mock in favor of using the BufferingLogger
  catch ValueError thrown on PHP 8
  [Yaml Parser] Fix edge cases when parsing multiple documents
  fix parsing comments not prefixed by a space
  [Translator] Make sure a null locale is handled properly
  deal with errors being thrown on PHP 8
  [Cache] Allow cache tags to be objects implementing __toString()
  [HttpKernel] Do not override max_redirects option in HttpClientKernel
  remove superfluous cast
  [HttpClient] Support for CURLOPT_LOCALPORT.
  Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
  Fixed exception message formatting
  [FrameworkBundle] Fix error in xsd which prevent to register more than one metadata
  [Console] work around disabled putenv()
  [PhpUnitBridge] Fix error with ReflectionClass
  [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm
  Change 'cache_key' to AbstractRendererEngine::CACHE_KEY_VAR
  Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
2020-09-18 16:27:32 +02:00
Christian Flothmann
50f37f0ccc fix merge 2020-09-18 16:07:46 +02:00
Christian Flothmann
d1353c0602 Merge branch '3.4' into 4.4
* 3.4:
  drop logger mock in favor of using the BufferingLogger
  [Yaml Parser] Fix edge cases when parsing multiple documents
  fix parsing comments not prefixed by a space
2020-09-18 15:54:02 +02:00
Christian Flothmann
f6f162dcdd fix test by letting mock throw the actual expected exception 2020-09-18 15:46:38 +02:00
Christian Flothmann
86a7e3289b drop logger mock in favor of using the BufferingLogger 2020-09-18 14:06:50 +02:00
Alexander M. Turek
14642fb6dd Added missing changelog entries. 2020-09-18 12:11:46 +02:00
Christian Flothmann
e299544639 minor #38231 [Validator] catch ValueError thrown on PHP 8 (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Validator] catch ValueError thrown on PHP 8

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

see php/php-src@95f4ee38bb

Commits
-------

fb0d7beaaf catch ValueError thrown on PHP 8
2020-09-18 12:06:31 +02:00
Fabien Potencier
2eeb75dd6f bug #38228 [Yaml Parser] Fix edge cases when parsing multiple documents (digilist)
This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml Parser] Fix edge cases when parsing multiple documents

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

I identified some edge cases when parsing multiple YAML documents with the same parser instance, because the totalNumberOfLines was not reset and so any subsequent parsing considered the number of lines of the first document.

Consider this document:
```yaml
a:
    b: |
        row
        row2
c: d
```

Normally, `a.b` would be parsed as `row\nrow2\n`. But if the parser parsed a shorter document before, the `\n` after row2 was missing, as the parser considered it as the end of the file (that's why the `c: d` at the end is important).

So this fix resets the `totalNumberOfLines` in the YAML parser to `null` so that any subsequent parsing will initialize the value for the new document and does not use the file length of the first parsed document.

I stumbled upon this because of a flickering unit test that was using the translation component. Sometimes the translated string contained a trailing `\n` and sometimes not. In the end it was based on this bug, as the translation files were not loaded in the same order every time (not really sure why. It's somehow related to the cache state, but even with a warm cache it was not totally deterministic).

Commits
-------

012ee4fa59 [Yaml Parser] Fix edge cases when parsing multiple documents
2020-09-18 12:04:33 +02:00
Christian Flothmann
fb0d7beaaf catch ValueError thrown on PHP 8 2020-09-18 11:45:13 +02:00
Christian Flothmann
74f41f3313 bug #38229 [Yaml] fix parsing comments not prefixed by a space (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml] fix parsing comments not prefixed by a space

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

Commits
-------

35b223aaa4 fix parsing comments not prefixed by a space
2020-09-18 11:29:40 +02:00
Markus Fasselt
012ee4fa59 [Yaml Parser] Fix edge cases when parsing multiple documents 2020-09-18 11:21:31 +02:00
Christian Flothmann
35b223aaa4 fix parsing comments not prefixed by a space 2020-09-18 11:15:17 +02:00
Fabien Potencier
785a06653c bug #38127 [Translator] Make sure a null locale is handled properly (jschaedl)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Translator] Make sure a null locale is handled properly

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

080ea5a0f7 [Translator] Make sure a null locale is handled properly
2020-09-18 10:46:54 +02:00
Jan Schädlich
080ea5a0f7 [Translator] Make sure a null locale is handled properly 2020-09-18 10:46:47 +02:00
Christian Flothmann
948e107a1b Merge branch '3.4' into 4.4
* 3.4:
  deal with errors being thrown on PHP 8
2020-09-18 10:35:10 +02:00
Christian Flothmann
6175d528e8 deal with errors being thrown on PHP 8 2020-09-18 10:10:16 +02:00
Fabien Potencier
791761277d bug #38221 [Cache] Allow cache tags to be objects implementing __toString() (lstrojny)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Cache] Allow cache tags to be objects implementing __toString()

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

`\Symfony\Contracts\Cache\CacheInterface::get(string $key, …)` implicitly converts objects with `__toString` while `CacheItem::tag()` will throw an exception. That’s a bit of a sharp edge.

Commits
-------

c2c03e050f [Cache] Allow cache tags to be objects implementing __toString()
2020-09-17 12:06:33 +02:00
Lars Strojny
c2c03e050f [Cache] Allow cache tags to be objects implementing __toString() 2020-09-17 12:06:27 +02:00
Fabien Potencier
2f67bf3a37 bug #38212 [HttpKernel] Do not override max_redirects option in HttpClientKernel (dmolineus)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Do not override max_redirects option in HttpClientKernel

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

As [proposed](https://github.com/symfony/symfony/issues/38207#issuecomment-693382336) by @nicolas-grekas this pull request removes the `max_redirects` setting in the `\Symfony\Component\HttpKernel\HttpClientKernel::handle` method.

It solves the issue that requests made by the `\Symfony\Component\HttpClient\CachingHttpClient` wouldn't follow redirects as described in the linked issue.

Commits
-------

981a11beed [HttpKernel] Do not override max_redirects option in HttpClientKernel
2020-09-17 12:05:06 +02:00
David Molineus
981a11beed [HttpKernel] Do not override max_redirects option in HttpClientKernel 2020-09-17 12:05:00 +02:00
Wouter de Jong
68f891ff65 Log notice when no entry point is configured 2020-09-17 11:39:20 +02:00
Fabien Potencier
8d450130e0 feature #38182 [HttpClient] Added RetryHttpClient (jderusse)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] Added RetryHttpClient

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

This PR adds a new HttpClient decorator to automatically retry failed requests.

When calling API, A very small % of requests are expected to timeout due to transient network issues. Some providers like AWS recommends retrying these requests and use a lower connection timeout so that the clients can fail fast and retry.

I used the almost the same configuration as Messenger
```yaml
framework:
    http_client:
        default_options:
            retry_failed:
                enabled: true // default false
                decider_service: null
                backoff_service: null
                http_codes: [423, 425, 429, 500, 502, 503, 504, 507, 510]
                max_retries: 3
                delay: 1000
                multiplier: 2
                max_delay: 0
                response_header: true
        scoped_clients:
            github:
                scope: 'https://api\.github\.com'
                retry_failed:
                    max_delay: 2000
```

Commits
-------

712ac5999d [HttpClient] Added RetryHttpClient
2020-09-17 11:07:30 +02:00
Jérémy Derussé
712ac5999d [HttpClient] Added RetryHttpClient 2020-09-17 11:07:22 +02:00
Fabien Potencier
86c7113994 Merge branch '5.1'
* 5.1:
  [String] improve slugger's portability accross implementations of iconv()
  Fix errors parsing in FirebaseTransport
2020-09-17 09:22:48 +02:00
Wouter de Jong
afdd805b1c [Security] Added login throttling feature 2020-09-17 07:36:46 +02:00
Fabien Potencier
ad226185af bug #38215 [HttpClient] Support for CURLOPT_LOCALPORT (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] Support for CURLOPT_LOCALPORT

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

Commits
-------

45fa6b8f24 [HttpClient] Support for CURLOPT_LOCALPORT.
2020-09-17 06:58:25 +02:00
Fabien Potencier
c965be8aaa minor #38214 Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3) (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3)

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

This is #38103 on the 4.4 branch.

Commits
-------

73647e5ffe Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
2020-09-17 06:54:14 +02:00
Fabien Potencier
ee0f5a2a4d Merge branch '3.4' into 4.4
* 3.4:
  remove superfluous cast
  Change 'cache_key' to AbstractRendererEngine::CACHE_KEY_VAR
  Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
2020-09-17 06:53:48 +02:00
Tom Klingenberg
05a9660a1e remove superfluous cast
in YAML component.

minor.
2020-09-17 01:52:20 +02:00
Alexander M. Turek
45fa6b8f24 [HttpClient] Support for CURLOPT_LOCALPORT. 2020-09-17 00:10:08 +02:00
Alexander M. Turek
73647e5ffe Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3). 2020-09-16 23:25:34 +02:00
Fabien Potencier
83910df242 feature #38007 [Amqp] Add amqps support (vasilvestre-OS)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Amqp] Add amqps support

| 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 #37002
| License       | MIT
| Doc PR        | symfony/symfony-docs#... TODO <!-- required for new features -->

### Cases

_Case 1 (simple):_
I want to set up my app with a locally installed amqp broker supporting SSL. No auth is needed, no vhost, only SSL certificate file located at /etc/ssl/cafile.
'amqps://'

_Case 2 (complex):_
I use a special port, special file locations for SSL. I pass it through php.ini or configuration.

### Questions

1) Actually AmqpTransportFactory use `supports` function to see if 'amqp://' is contained in dsn string and accept cacert argument to use SSL
How are we supposed to cover AMQPS's case in your opinion?

cacert argument is settable through php.ini and code.

### Observations

I think this PR should aim at:

- Having correct defaults ssl values in case of 'amqps://' eg : case 1
- Being able to pass cacert file path and verify argument. eg : case 2
- Test: but test what?

#### EDIT

As discuted with @nicolas-grekas, we should check that cacert is existing in php.ini or is passed in configuration and throw an exception to give a nice feedback about what's wrong. Php amqp lib isn't actually precise about why it fails when you forget it.

### Steps

- [x] Ensure AMQPS can be used out of the box without DSN.
- [x] If not, try to modify vendor directly to fix it.
- [x] Modify vendor to make AMQPS works with DSN.
- [x] Check cacert to throw a better exception.
- [x] Add test related to last point.
- [ ] Pass CI

Commits
-------

99fc3f3b89 [Amqp] Add amqps support
2020-09-16 15:50:25 +02:00
Fabien Potencier
7cd5bbf458 feature #37546 [RFC] Introduce a RateLimiter component (wouterj)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[RFC] Introduce a RateLimiter component

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

Based on the discussions in #37444, I decided to write a general purpose RateLimiter component. This implementation uses the token bucket algorithm, inspired by the [Go's time/rate](3af7569d3a/rate/rate.go) library and the [PHP `bandwidth-throttle/token-bucket` package](https://github.com/bandwidth-throttle/token-bucket) (which is [unmaintained for years](https://github.com/bandwidth-throttle/token-bucket/issues/19)).

### Usage

The component has two main methods:

* `Limiter::reserve(int $tokens, int $maxTime)`, allocates `$tokens` and returns a `Reservation` containing the wait time. Use this method if your process wants to wait before consuming the token.
* `Limiter::consume(int $tokens)`, checks if `$tokens` are available now and discards the reservation if that's not the case. Use this method if you want to skip when there are not enough tokens at this moment.

The component uses the Lock component to make sure it can be used in parallel processes.

Example:

```php
<?php

namespace App\EventListener;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\RateLimiter\LimiterFactory;

class LimitListener
{
    private $limiterFactory;

    public function __construct(LimiterFactory $apiLimiterFactory)
    {
        $this->limiterFactory = $apiLimiterFactory;
    }

    public function __invoke(RequestEvent $event)
    {
        $ip = $event->getRequest()->getClientIp();

        $limiter = $this->limiterFactory->createLimiter(preg_replace('/[^a-zA-Z0-9]/', '-', $ip));
        if (!$limiter->consume()) {
            $event->setResponse(new Response('Too many requests', 429));
        }
    }
}
```

### Usefullness of the component

I think a generic rate limiter is usefull in quite some places:

* Add a login throttling feature in Symfony
* <s>Rate limiting outgoing API calls (e.g. HttpClient), to prevent hitting upstream API limits.</s> See #37471 (and https://blog.heroku.com/rate-throttle-api-client )
* Allowing users to easily implement API rate limits in their own Symfony-based APIs.

### State of the art

There are some rate limiting packages in PHP, but I think there is no precendent for this component:

* [`graham-campbell/throttle`](https://github.com/GrahamCampbell/Laravel-Throttle) is heavily relying on Laravel. It is however very popular, proofing there is a need for such feature
* [`nikolaposa/rate-limit`](https://github.com/nikolaposa/rate-limit) does not implement reservation of tokens and as such less feature complete. Also its architecture combines the rate limiter and storage, making it harder to implement different storages.

### Todo

If it is agreed that this component can bring something to Symfony, it needs some more love:

* [x] Add more tests
* [x] Integrate with the FrameworkBundle
* [x] Add sliding window implementation
* [x] Add integration with the Security component
* <s>Maybe add more storage implementations? I didn't want to duplicate storage functionalities already existing in the Lock and Cache component, thus I for now focused mostly on integrating the Cache adapters. But maybe a special Doctrine adapter makes sense?</s>

Commits
-------

67417a693e [RFC] Introduce a RateLimiter component
2020-09-16 15:45:08 +02:00
Wouter de Jong
67417a693e [RFC] Introduce a RateLimiter component 2020-09-16 15:45:01 +02:00
Fabien Potencier
128bbd11eb feature #38193 Make RetryTillSaveStore implements the SharedLockStoreInterface (jderusse)
This PR was merged into the 5.2-dev branch.

Discussion
----------

Make RetryTillSaveStore implements the SharedLockStoreInterface

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

The `RetryTillSaveStore` decorates a non blocking store (ie. `RedisStore`) to make it blockable.
The issue is: if the decorate store manage SharedLock, the Decorator does not implements this interface. It's currently not possible to get both `blocking` and `sharable` store.

Commits
-------

a0321e66c9 Make RetryTillSaveStore implements the SharedLockStoreInterface
2020-09-16 14:38:44 +02:00
Fabien Potencier
c34865f175 feature #37968 [Form] Add new way of mapping data using callback functions (yceruto)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Form] Add new way of mapping data using callback functions

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | yes
| Tickets       | Fix #37597 (partially)
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/14241

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

## What this solves

Objects and Forms have different mechanisms for structuring data. When you build an object model with a lot of business logic it's valuable to use these mechanisms to better collect the data and the behavior that goes with it. Doing so leads to variant schemas; that is, the object model schema and the form schema don't match up.

You still need to transfer data between the two schemas, and this data transfer becomes a complexity in its own right. If the objects know about the form structure, changes in one tend to ripple to the other.

Currently, the Data Mapper layer separates the objects from the form, transfering data between the two and also isolating them from each other. That's fine, but at present the default data mapper has a limitation: _it's very tied to one property path_ (see [`PropertyPathMapper`](https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php)).

That said, you'll have to write your own data mapper in the following situations:
 * When the property path differs for reading and writing
 * When several form fields are mapped to a single method
 * When you need to read data based on the model's state
 * When the mapping of the model depends on the submitted form data
 * ...

Also, when we create a new data mapper, we usually forget about checking the status of the given data and forms. Whether the data is empty or not; throw an exception if the given data is not an object/array and whether the form field is submitted/synchronized/disabled or not. Not doing that could lead to unwanted behavior.

## What this proposes

Create a new way to write and read values to/from an object/array using callback functions. This feature would be tied to each form field and would also mean a new way of mapping data, but a very convenient one, in which it won't be necessary to define a new data mapper and take into account all what it would imply when you only need to map one field in a different manner or perhaps in only one direction (writing or reading the value).

This PR adds two new options for each form type: `getter` and `setter`, allowed to be `null` or `callable`:
```php
$builder->add('name', TextType::class, [
    'getter' => function (Person $person, FormInterface $form): string {
        return $person->firstName().' '.$person->lastName();
    },
    'setter' => function (Person &$person, ?string $name, FormInterface $form): void {
        $person->rename($name);
    },
]);
```
This would give us the same possibilities as data mappers, but within the form field scope, where:
 * `$person` is the view data, basically the underlying data to the form.
 * `$form` is the current child form that is being mapped.
 * `$name` is the submitted data that belongs to that field.

These two callbacks will be executed following the same rules as for property paths before read and write any value (e.i. early return if empty data, skip mapping if the form field is not mapped or it's disabled, etc).

## What this also proposes

I based the implementation on solving this problem first:

> https://github.com/symfony/symfony/pull/37614#issuecomment-662957865
> [...] the property_path option defines the rules on how it's accessed. From there, the actual way it is accessed (direct property access, accessors, reflection, whatever) are hidden from view. All that matters is the property path (which is deduced from the name if not explicitly set). [...]

So splitting the default data mapper `PropertyPathMapper` into two artifacts: "[DataMapper](https://github.com/yceruto/symfony/blob/data_accessor/src/Symfony/Component/Form/Extension/Core/DataMapper/DataMapper.php)" and "[DataAccessor](https://github.com/yceruto/symfony/blob/data_accessor/src/Symfony/Component/Form/DataAccessorInterface.php)" would allow us adding multiple data accessors along the way (the code that varies in this case) without having to reinvent the wheel over and over again (the data mapper code).

You can also think about a new `ReflectionAccessor` for instance? or use this `CallbackAccessor` to map your form partially from an external API? yes, you could do it :)

Here is a view of the proposed changes:

![data_accessor](https://user-images.githubusercontent.com/2028198/91452859-16bf8f00-e84d-11ea-8564-d497c2f73730.png)

Where "DataMapper" will take care of common checks, iterates the given child forms, manages the form data and all what is needed for mapping a standard form, whereas "DataAccessor" will take care of how to read and write values to/from the underlying object or array.

## BC

The `PropertyPathMapper` is being deprecated in favor of `DataMapper` class, which uses the `PropertyPathAccessor` by default.

Although `DataMapper` is now the default for each compound form, the behavior must remains the same (tests prove it). So that if `getter` or `setter` option is null (they're by default) the `CallbackAccessor` will falls back to `PropertyPathAccessor` either for reading or writing values.

---

Sorry for the long description, but I think that sometimes it is necessary for too complex issues and big changes. Besides, now you know a little more about what these changes is about.

/cc @xabbuh as creator of [rich-model-forms-bundle](https://github.com/sensiolabs-de/rich-model-forms-bundle) and @alcaeus as you had worked on this issue.

WDYT?

Commits
-------

878effaf47 add new way of mapping data using callback functions
2020-09-16 14:32:39 +02:00
Jérémy Derussé
a0321e66c9
Make RetryTillSaveStore implements the SharedLockStoreInterface 2020-09-16 13:06:13 +02:00
Yonel Ceruto
878effaf47 add new way of mapping data using callback functions 2020-09-15 10:00:10 -04:00
Nicolas Grekas
21e4e320b4 [String] improve slugger's portability accross implementations of iconv() 2020-09-15 14:23:47 +02:00
Nicolas Grekas
0bb48df2b0 [String] allow translit rules to be given as closure 2020-09-15 14:13:10 +02:00
SenTisso
d3f909bff3 [Console] work around disabled putenv() 2020-09-15 09:58:55 +02:00
Nicolas Grekas
ae655bf6d4 bug #38190 [Notifier] Fix errors parsing in FirebaseTransport (jderusse)
This PR was merged into the 5.1 branch.

Discussion
----------

[Notifier] Fix errors parsing in FirebaseTransport

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

I noticed that, when parsing the response, this transport use `getHeader()` like a `string[]` instead of `string[][]`.

I did not test it and I'm not sure about this fix: could you have a look @Jeroeny ?

Commits
-------

2818e2cd43 Fix errors parsing in FirebaseTransport
2020-09-15 09:17:03 +02:00
Nicolas Grekas
61c1175d05 bug #38173 [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm (ybenhssaien)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm

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

If option is `auth_ntlm` an exception is thrown, `$alternatives` then is not used.

Commits
-------

ab1a96c999 [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm
2020-09-15 09:11:04 +02:00
Youssef BENHSSAIEN
ab1a96c999 [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm 2020-09-15 09:10:35 +02:00
Jérémy Derussé
2818e2cd43
Fix errors parsing in FirebaseTransport 2020-09-15 08:07:14 +02:00
Thibault RICHARD
1ff3e293e0 [Mailer] Mailjet - Allow using Reply-To with Mailjet API 2020-09-15 07:09:07 +02:00
vladyslavstartsev
4fcb41c3ba
Change 'cache_key' to AbstractRendererEngine::CACHE_KEY_VAR
The purpose of this change is to find all usages of AbstractRendererEngine::CACHE_KEY_VAR. Currently, if you search for AbstractRendererEngine::CACHE_KEY_VAR you will see only access to it, i.e. (`$view->vars[AbstractRendererEngine::CACHE_KEY_VAR]`), but you can't find it in write level. With this pull request you can see where is was used for write.
2020-09-14 19:22:49 +03:00
Fabien Potencier
28edd705e8 * 5.1:
[Messenger] Improve error message readability
  fix filename being cleaned up at end of tests
2020-09-14 17:02:31 +02:00
Fabien Potencier
2df87a36bd Merge branch '4.4' into 5.1
* 4.4:
  [Messenger] Improve error message readability
  fix filename being cleaned up at end of tests
2020-09-14 17:02:15 +02:00
Laurent VOULLEMIER
63bc620efa [Messenger] Improve error message readability
Since slashes are escaped, vhosts are not very readable.
2020-09-14 16:48:28 +02:00
Alexander M. Turek
ff47516ea0 Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3). 2020-09-14 08:11:19 +02:00
Ryan Weaver
3780f122c7 adding the description to a missing option 2020-09-13 10:51:40 -04:00
Valentin
99fc3f3b89 [Amqp] Add amqps support 2020-09-13 07:20:39 +02:00
Fabien Potencier
3b1ab7bfac Merge branch '5.1'
* 5.1:
  Internal classes are not legacy.
  [HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
  add choice_translation_domain tests to prevent further regressions
  Update validators.tr.xlf
2020-09-13 07:01:37 +02:00
Fabien Potencier
9fae49fb20 Merge branch '4.4' into 5.1
* 4.4:
  Internal classes are not legacy.
  [HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
  add choice_translation_domain tests to prevent further regressions
  Update validators.tr.xlf
2020-09-13 07:01:27 +02:00
Fabien Potencier
f2e7158bc0 Merge branch '3.4' into 4.4
* 3.4:
  [HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
  add choice_translation_domain tests to prevent further regressions
  Update validators.tr.xlf
2020-09-13 07:00:26 +02:00
Alexander M. Turek
d6d9b2927d [HttpFoundation] Skip the cookie_max_age fixture on PHP 8. 2020-09-12 22:41:00 +02:00
Fabien Potencier
f1f37a899c Fix CS 2020-09-12 10:28:26 +02:00
Jérôme Vasseur
20f316906e [RFC][HttpKernel][Security] Allowed adding attributes on controller arguments that will be passed to argument resolvers. 2020-09-12 10:22:10 +02:00
Jérémy Derussé
a7d51937f0 [RFC][lock] Introduce Shared Lock (or Read/Write Lock) 2020-09-12 07:27:01 +02:00
Fabien Potencier
8a89170284 Fix CHANGELOG 2020-09-12 07:23:15 +02:00
Fabien Potencier
9b84bc0e78 feature #37759 [Messenger] - Add option to confirm message delivery in Amqp connection (scyzoryck)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Messenger] - Add option to confirm message delivery in Amqp connection

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

Hello! My first PR here.

Sometimes we need to be sure that messages are delivered to Amqp. To make it work we need to wait for the confirmation from the Amqp server. So let's wait for it confirmation if confirmation timeout is defined. Default behaviour are not modified - waiting for confirmation will impact performance of sending message.

Commits
-------

5682d76b2a Messenger - Add option to confirm message delivery in Amqp connection
2020-09-12 07:22:34 +02:00
Fabien Potencier
adedd76a3d feature #30572 [Cache] add integration with Messenger to allow computing cached values in a worker (nicolas-grekas)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Cache] add integration with Messenger to allow computing cached values in a worker

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

~~This PR needs and for now embeds #30334. See 2nd commit.~~

Using the new `CacheInterface` enables probabilistic early expiration by default. This means that from time to time, items are elected as early-expired while they are still fresh ([see Wikipedia](https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration) for details).

This PR adds a new `early_expiration_message_bus` option when configuring cache pools. When this option is set, cache pools are configured to send those early-expired items on a Messenger bus, then serve the current value immediately, while the updated value is computed in a worker in the background.

`CacheInterface::get($key, $callback)` accepts any callable, but sending any callable on a bus is not possible (e.g. a `Closure` cannot be serialized). To bypass this constraint, this feature works only with callables in the form `[$service, 'publicMethod']`, where `$service` is any public or [reversible service](https://github.com/symfony/symfony/pull/30334).

This constraint is a serious one: this $service must compute a value when knowing only its key. This means keys should embed enough information for this to happen. I think that's not that hard - and we may find ways to provide additional context in the future.

At least the goal is worth it: in theory, this strategy allows achieving a 100% hit ratio even when invalidation-by-expiration is used.

There are two things one needs to do to enable this behavior:

1. bind a message bus to a cache pool:
```yaml
framework:
    cache:
        pools:
            test.cache:
                early_expiration_message_bus: messenger.default_bus
```

2. route EarlyExpirationMessage to a transport:
```yaml
framework:
    messenger:
        routing:
            'Symfony\Component\Cache\Messenger\EarlyExpirationMessage': amqp
```

Commits
-------

6c0911f58c [Cache] add integration with Messenger to allow computing cached values in a worker
2020-09-12 07:07:36 +02:00
Fabien Potencier
11b142928a feature #38149 [SecurityBundle] Comma separated ips for security.access_control (a-menshchikov)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[SecurityBundle] Comma separated ips for security.access_control

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

There is currently no way to use env vars to configure `security.access_control` ips with multiple values. Ability to use comma separated ips make it able.

Commits
-------

0412e91060 [SecurityBundle] Comma separated ips for security.access_control
2020-09-12 07:06:14 +02:00
Zmey
0412e91060 [SecurityBundle] Comma separated ips for security.access_control 2020-09-12 07:06:09 +02:00
Ramazan
f346eccb60 Update validators.tr.xlf
Turkish Spelling error corrected.
2020-09-11 17:36:36 +02:00
Nicolas Grekas
fce331a978 Merge branch '5.1'
* 5.1:
  [Cache] fix merge
2020-09-11 15:55:47 +02:00
Nicolas Grekas
ca8944b512 [Cache] fix merge 2020-09-11 15:55:31 +02:00
Nicolas Grekas
6c0911f58c [Cache] add integration with Messenger to allow computing cached values in a worker 2020-09-11 15:42:58 +02:00
Christian Flothmann
6d5617d08d Merge branch '5.1' into master
* 5.1:
  fix merge
  [Cache] fix previous PR
  add mising sr (latn & cyrl) translations
  [Cache] fix ProxyAdapter not persisting items with infinite expiration
  [HttpClient] fail properly when the server replies with HTTP/0.9
  Fix CS
  [Cache] Limit cache version character range
  [Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json
  [String] improve fix
  fix tests
  [DI] dump OS-indepent paths in the compiled container
  [DI] dump OS-indepent paths in the preload file
  Run postgres setup trigger in transaction
  allow consumers to mock all methods
2020-09-11 14:25:32 +02:00
Christian Flothmann
f5b08da897 fix merge 2020-09-11 14:17:27 +02:00
Nicolas Grekas
25941ffe73 [Cache] fix previous PR 2020-09-11 13:46:01 +02:00
Nicolas Grekas
da71a5d933 Merge branch '4.4' into 5.1
* 4.4:
  add mising sr (latn & cyrl) translations
  [Cache] fix ProxyAdapter not persisting items with infinite expiration
  [HttpClient] fail properly when the server replies with HTTP/0.9
  Fix CS
  [Cache] Limit cache version character range
  [DI] dump OS-indepent paths in the compiled container
  allow consumers to mock all methods
2020-09-11 13:43:06 +02:00
Nicolas Grekas
ac188871c2 bug #38156 [Cache] fix ProxyAdapter not persisting items with infinite expiration (dmaicher)
This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] fix ProxyAdapter not persisting items with infinite expiration

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

Commits
-------

d3af877022 [Cache] fix ProxyAdapter not persisting items with infinite expiration
2020-09-11 13:34:06 +02:00
Nicolas Grekas
77530a9b75 Merge remote-tracking branch 'origin/3.4' into 4.4
* origin/3.4:
  add mising sr (latn & cyrl) translations
  allow consumers to mock all methods
2020-09-11 13:33:24 +02:00
ivan
e927c7cf69 add mising sr (latn & cyrl) translations 2020-09-11 11:15:49 +02:00
David Maicher
d3af877022 [Cache] fix ProxyAdapter not persisting items with infinite expiration 2020-09-11 11:01:32 +02:00
Nicolas Grekas
0383e53e5c bug #38148 [HttpClient] fail properly when the server replies with HTTP/0.9 (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fail properly when the server replies with HTTP/0.9

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

Commits
-------

96759af1da [HttpClient] fail properly when the server replies with HTTP/0.9
2020-09-11 09:06:13 +02:00
Nicolas Grekas
96759af1da [HttpClient] fail properly when the server replies with HTTP/0.9 2020-09-11 08:30:42 +02:00
Fabien Potencier
dafcc58e6b bug #38153 Move form error normalizer to the Serializer component (fabpot)
This PR was merged into the 5.2-dev branch.

Discussion
----------

Move form error normalizer to the Serializer component

| 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 #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

c053db5553 Move form error normalizer to the Serializer component
2020-09-11 08:29:22 +02:00
Fabien Potencier
c053db5553 Move form error normalizer to the Serializer component 2020-09-11 08:19:30 +02:00
Fabien Potencier
1b5f996378 Fix CS 2020-09-11 07:50:30 +02:00
Fabien Potencier
cc9c48fe14 Fix tests 2020-09-11 07:35:08 +02:00
Fabien Potencier
7a0cc2c0e4 Fix CS 2020-09-11 07:25:20 +02:00
Fabien Potencier
8cb2d296f9 Fix previous merge 2020-09-11 07:20:58 +02:00
Tomas
d6a899395b Update based on feedback 2020-09-11 07:18:37 +02:00
Guillaume Pédelagrabe
1c21c78d25 UidNormalizer. 2020-09-11 07:18:37 +02:00
Nicolas Grekas
be6146c566 [HttpClient] fix compat with older PHP/curl versions 2020-09-10 20:24:52 +02:00
Nicolas Grekas
5aadd607ce [HttpClient] forbid CURLOPT_HTTP09_ALLOWED 2020-09-10 20:22:28 +02:00
Maxime Steinhausser
1e8ae43372 [Messenger] Don't prevent dispatch out of another bus 2020-09-10 19:13:35 +02:00
Fabien Potencier
4bbb250d83 bug #38140 [DI] dump OS-indepent paths in the preload file (nicolas-grekas)
This PR was merged into the 5.1 branch.

Discussion
----------

[DI] dump OS-indepent paths in the preload file

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

This allows generating the file on Windows and running it on Linux (Docker).

Commits
-------

e8feba5c36 [DI] dump OS-indepent paths in the preload file
2020-09-10 19:00:34 +02:00
Fabien Potencier
44dd80f3fd bug #38139 [DI] dump OS-indepent paths in the compiled container (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI] dump OS-indepent paths in the compiled container

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

This allows compiling on Windows and running on Linux (Docker).

Commits
-------

4dcf9e7d13 [DI] dump OS-indepent paths in the compiled container
2020-09-10 18:59:53 +02:00
Fabien Potencier
9cd3e674e6 bug #38141 [Messenger] Added factory methods to DelayStamp for better DX (Toflar)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Messenger] Added factory methods to DelayStamp for better DX

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

I often find myself delaying messages for a few minutes or so and I always have to remember the `DelayStamp` uses milliseconds. I guess these simple factories could improve DX quite a bit :)

Commits
-------

fdc8da0aaa [Messenger] Added factory methods to DelayStamp for better DX
2020-09-10 18:59:02 +02:00
Yanick Witschi
fdc8da0aaa [Messenger] Added factory methods to DelayStamp for better DX 2020-09-10 18:54:55 +02:00
Nicolas Grekas
474e877035 feature #38134 [Lock] Fix wrong interface for MongoDbStore (jderusse)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Lock] Fix wrong interface for MongoDbStore

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

The MongoDbStore is not a `BlockingStore` because does not "really" implements  the method `waitAndSave`.

This PR changes the interface of `MongoDbStore` and remove the dummy implementation of `waitAndSave`.

Commits
-------

4c2d32ce11 Fix wrong interface for MongoDbStore
2020-09-10 18:54:54 +02:00
Jérémy Derussé
4c2d32ce11 Fix wrong interface for MongoDbStore 2020-09-10 18:54:38 +02:00
Fabien Potencier
b84f3cea9a bug #38147 [Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json (asprega)
This PR was merged into the 5.1 branch.

Discussion
----------

[Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json

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

Handles gracefully cases in which the Mailgun API does not return JSON responses.

Commits
-------

ce8f7e5c02 [Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json
2020-09-10 18:48:58 +02:00
Lars Strojny
15c21db856 [Cache] Limit cache version character range 2020-09-10 18:47:22 +02:00
Nicolas Grekas
ff29f3ae11 minor #38144 [String] improve fix (nicolas-grekas)
This PR was merged into the 5.1 branch.

Discussion
----------

[String] improve fix

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

Improves https://github.com/symfony/symfony/pull/38128
(let's wait for the CI before merging)

Commits
-------

db4b1df062 [String] improve fix
2020-09-10 18:40:56 +02:00
Nicolas Grekas
f1fd3c0069 bug #38136 [Messenger] Run postgres setup trigger in transaction (akondas)
This PR was merged into the 5.1 branch.

Discussion
----------

[Messenger] Run postgres setup trigger in transaction

| Q             | A
| ------------- | ---
| Branch?       | 5.1 <!-- see below -->
| 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 #37179 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | n/a <!-- required for new features -->

This PR fix `messenger:setup-transports` command when using with ` doctrine/doctrine-bundle` version >= 2.1

Commits
-------

7ed93b4dc0 Run postgres setup trigger in transaction
2020-09-10 18:35:00 +02:00
Andrea Sprega
ce8f7e5c02 [Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json
- Fixes issue #38146
2020-09-10 17:34:37 +02:00
Nicolas Grekas
db4b1df062 [String] improve fix 2020-09-10 15:37:03 +02:00
Fabien Potencier
4c873fe501 feature #38135 [AmazonSqsMessenger] Added the count message awareness on the transport (raphahardt)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[AmazonSqsMessenger] Added the count message awareness on the transport

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

Added the possibility of have message count awareness of the receiver on the transport.

Commits
-------

96b63b83bf [AmazonSqsMessenger] Added the count message awareness on the transport
2020-09-10 14:42:05 +02:00
Fabien Potencier
ad0c9f5d62 Merge branch '5.1'
* 5.1:
  [FrameworkBundle] adopt src/.preload.php
  [Cache] Fix key encoding issue in Memcached adapter
  [HttpClient] Fix Array to string conversion notice when parsing JSON error body with non-scalar detail property
2020-09-10 14:33:14 +02:00
Fabien Potencier
4409a30dee Merge branch '4.4' into 5.1
* 4.4:
  [FrameworkBundle] adopt src/.preload.php
  [Cache] Fix key encoding issue in Memcached adapter
  [HttpClient] Fix Array to string conversion notice when parsing JSON error body with non-scalar detail property
2020-09-10 14:33:01 +02:00
Nicolas Grekas
4dcf9e7d13 [DI] dump OS-indepent paths in the compiled container 2020-09-10 12:08:39 +02:00
Nicolas Grekas
e8feba5c36 [DI] dump OS-indepent paths in the preload file 2020-09-10 11:51:08 +02:00
Tobias Schultze
38e414003c minor #38138 [Translation] fix parsing tokens on PHP 8 (xabbuh)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Translation] fix parsing tokens on PHP 8

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

Commits
-------

1d1194e973 fix parsing tokens on PHP 8
2020-09-10 11:38:32 +02:00
Christian Flothmann
6bf856cd15 Merge branch '5.1' into master
* 5.1:
  ensure that the offset is part of the string
2020-09-10 10:46:37 +02:00
Nicolas Grekas
0ceafbcbea feature #38026 [HttpClient] Allow to provide additional curl options to CurlHttpClient (pizzaminded)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] Allow to provide additional curl options  to CurlHttpClient

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #37798
| License       | MIT
| Doc PR        | symfony/symfony-docs#14195

~~**Tagging as a draft because:**~~
- ~~there is no Doc PR Ready yet~~
- probably there are better test cases required here.

This PR introduces an option to override default curl options defined in `CurlHttpClient`.  To override them, there is a special place in `$options` provided:

````php
$response = $httpClient->request('GET', 'http://your.url.here', [
            'extra' => [
                'curl' => [
                    CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
                ]
            ]
        ]);
````

This feature is available only in `CurlHttpClient` and would be ignored in another clients.

Commits
-------

89329bd979 [HttpClient] Allow to provide additional curl options  to CurlHttpClient
2020-09-10 10:40:05 +02:00
pizzaminded
89329bd979 [HttpClient] Allow to provide additional curl options to CurlHttpClient 2020-09-10 10:39:47 +02:00
Christian Flothmann
1d1194e973 fix parsing tokens on PHP 8 2020-09-10 10:35:47 +02:00
Arkadiusz Kondas
7ed93b4dc0
Run postgres setup trigger in transaction 2020-09-10 10:05:16 +02:00
Raphael Hardt
96b63b83bf [AmazonSqsMessenger] Added the count message awareness on the transport 2020-09-10 02:04:08 -03:00
Christian Flothmann
3227303dab allow consumers to mock all methods 2020-09-09 19:04:53 +02:00
Christian Flothmann
a6c046f3ab ensure that the offset is part of the string 2020-09-09 14:58:41 +02:00
Christian Flothmann
1bdae34365 Merge branch '5.1' into master
* 5.1:
  [Intl] promote warnings to value errors on PHP 8
  Fix CS
  DateTime validator support for trailing data
  Remove some leftover for HHVM support
  Simplify code
  Fix tests on 5.6
  [Debug] Skip a test that was meant for HHVM.
  [Console] Silence warnings on sapi_windows_cp_set() call
  guard $argv + $token against null, preventing unnecessary exceptions
2020-09-09 14:41:49 +02:00
Nicolas Grekas
afd4027c11 bug #38108 [Cache] Fix key encoding issue in Memcached adapter (lstrojny)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Cache] Fix key encoding issue in Memcached adapter

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | n.A.
| License       | MIT
| Doc PR        | Fix double encoding in memcached which lead to overlong keys being generated

Because the memcached adapter uses `rawurlencode()` to encode each and every key, keys will sometimes be too long and therefore hit the memcached limit of 250 bytes. This happens when the key is small enough to be below 250 when passed to `AbstractAdapterTrait::getId()` and is then blown up over the 250 bytes limit in memcached adapter without validating the length again.

Looking through the code, it seems that the double encoding is wholly unnecessary assuming if one makes sure the namespace is properly encoded. This PR therefore removes the double encoding and instead uses rawurlencode on the namespace (which is in turn properly accounted for when calculating whether or not we are over the ID limit).

Commits
-------

23bf9be8ce [Cache] Fix key encoding issue in Memcached adapter
2020-09-09 11:22:51 +02:00
Lars Strojny
23bf9be8ce [Cache] Fix key encoding issue in Memcached adapter 2020-09-09 11:22:35 +02:00
Nicolas Grekas
9bb80841ed bug #38122 [HttpClient] Fix Array to string conversion notice when parsing JSON error body with non-scalar detail property (emarref)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[HttpClient] Fix Array to string conversion notice when parsing JSON error body with non-scalar detail property

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

An earlier commit added the ability to detect common API formats and extract a useful error message from the error response payload. To achieve this, if a `title` and `detail` property are found in the error response, the response is considered to be in a known format (RFC 7807) and these values are concatenated to form a helpful error message.

However, when either `title` or `detail` property are present, but the document is not intended to follow the RFC semantics, if the properties are not scalar (e.g. if the detail property is an array of field validation violations) then the concatenation of the strings causes a notice to be raised.

This pull request checks that the `title` and `detail` properties are scalar before attempting to concatenate them. If they are not, no enhanced error message is provided.

Commits
-------

76fa884319 [HttpClient] Fix Array to string conversion notice when parsing JSON error body with non-scalar detail property
2020-09-09 11:17:46 +02:00
Malcolm Fell
76fa884319 [HttpClient] Fix Array to string conversion notice when parsing JSON error body with non-scalar detail property 2020-09-09 11:17:34 +02:00
Christian Flothmann
41cb27beb0 Merge branch '4.4' into 5.1
* 4.4:
  [Intl] promote warnings to value errors on PHP 8
  Fix CS
  DateTime validator support for trailing data
  Remove some leftover for HHVM support
  Simplify code
  Fix tests on 5.6
  [Debug] Skip a test that was meant for HHVM.
  [Console] Silence warnings on sapi_windows_cp_set() call
  guard $argv + $token against null, preventing unnecessary exceptions
2020-09-09 10:28:14 +02:00
Christian Flothmann
0ed20be407 Merge branch '3.4' into 4.4
* 3.4:
  [Intl] promote warnings to value errors on PHP 8
  Fix CS
  DateTime validator support for trailing data
2020-09-09 10:00:22 +02:00
Christian Flothmann
82d9d41d57 [Intl] promote warnings to value errors on PHP 8 2020-09-09 09:45:25 +02:00
Fabien Potencier
799624b6f1 Fix CS 2020-09-09 07:35:36 +02:00
Fabien Potencier
1e52146339 bug #37097 DateTime validator support for trailing data (stefankleff)
This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

DateTime validator support for trailing data

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

Commits
-------

27f6e28f5b DateTime validator support for trailing data
2020-09-09 07:34:53 +02:00
Stefan Kleff
27f6e28f5b DateTime validator support for trailing data 2020-09-09 07:34:45 +02:00
Fabien Potencier
cf9e75614b Remove some leftover for HHVM support 2020-09-09 07:20:36 +02:00
Fabien Potencier
80e5a7fbd8 feature #37559 [PropertyInfo] fix array types with keys (array<string, string>) (digilist)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[PropertyInfo] fix array types with keys (array<string, string>)

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

Array types with keys are currently not detected correctly from the PropertyInfo component:

```
@var array<string, string>
@var array<string, array<integer, string>>
```

Those are currently identified as object with class `rray<string, string>`.

This PR tries to fix it.

What I noticed while fixing this, is that union types in arrays are not supported in general at the moment, because the `Type` class supports only one collectionValueType and I do not see how to pass a Union Type there. But I guess that's a different issue and for those types I decided to return null as collection value type for now. (Or better throw on exception?)

Commits
-------

64f7bd7832 [PropertyInfo] fix array types with keys (array<string, string>)
2020-09-09 07:17:12 +02:00
Fabien Potencier
656fc3b82a Simplify code 2020-09-09 07:14:52 +02:00
Fabien Potencier
5ad8c2a630 Merge branch '3.4' into 4.4
* 3.4:
  Fix tests on 5.6
  [Debug] Skip a test that was meant for HHVM.
  [Console] Silence warnings on sapi_windows_cp_set() call
  guard $argv + $token against null, preventing unnecessary exceptions
2020-09-09 07:14:20 +02:00
Fabien Potencier
1df26c20a0 minor #38117 [Debug] Skip a test that was meant for HHVM (derrabus)
This PR was merged into the 3.4 branch.

Discussion
----------

[Debug] Skip a test that was meant for HHVM

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

This PR skips a test that fails on php 8. If I read the test correctly, it is meant to run on HHVM, so I assumed it's save to skip it if we're on PHP.

Commits
-------

bf62a4d622 [Debug] Skip a test that was meant for HHVM.
2020-09-09 07:12:18 +02:00
Fabien Potencier
336946a499 Fix tests on 5.6 2020-09-09 07:09:37 +02:00
Alexander M. Turek
bf62a4d622 [Debug] Skip a test that was meant for HHVM. 2020-09-09 00:19:14 +02:00