Commit Graph

51924 Commits

Author SHA1 Message Date
Denis Brumann
6ebf7e164e
Adds constants for YamlEncoder options 2020-11-08 12:35:30 +01:00
Maxime Steinhausser
50c7c3d364 bug #39002 [Validator] Override the default option of the choice constraint (benji07)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Validator] Override the default option of the choice constraint

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

We have a bundle that run test against the last version of symfony and we detect BC Break when passing a string as the first argument of the class Choice

Our code extends the Choice class and change the defaultOption.

I saw that others constraints class had new construct signature (for php8 attributes), but only some of them kept the array options as their first arguments. Why ?

ping @ogizanagi @derrabus

https://travis-ci.com/github/Elao/PhpEnums/jobs/410045368
```
1) Elao\Enum\Tests\Unit\Bridge\Symfony\Validator\Constraint\EnumTest::testDefaultValueIsEnumClass
Symfony\Component\Validator\Exception\MissingOptionsException: The options "class" must be set for constraint "Elao\Enum\Bridge\Symfony\Validator\Constraint\Enum".
/home/travis/build/Elao/PhpEnums/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraint.php:171
/home/travis/build/Elao/PhpEnums/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraint.php:110
/home/travis/build/Elao/PhpEnums/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Choice.php:75
/home/travis/build/Elao/PhpEnums/src/Bridge/Symfony/Validator/Constraint/Enum.php:39
/home/travis/build/Elao/PhpEnums/tests/Unit/Bridge/Symfony/Validator/Constraint/EnumTest.php:22
```

Commits
-------

d553750054 Allow user to override default options when extending the Choice Constraint
2020-11-07 17:47:31 +01:00
Robin Chalas
f226d981af Merge branch '5.1' into 5.x
* 5.1:
  [Messenger] Fix DBAL deprecations in PostgreSQLConnection
  [DoctrineBridge] Fix DBAL deprecations in middlewares.
2020-11-07 17:24:48 +01:00
Robin Chalas
245d04189e Merge branch '4.4' into 5.1
* 4.4:
  [DoctrineBridge] Fix DBAL deprecations in middlewares.
2020-11-07 17:24:27 +01:00
Robin Chalas
01316d6014 bug #39026 [Messenger] Fix DBAL deprecations in PostgreSqlConnection (chalasr)
This PR was merged into the 5.1 branch.

Discussion
----------

[Messenger] Fix DBAL deprecations in PostgreSqlConnection

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

Commits
-------

bc42cf604e [Messenger] Fix DBAL deprecations in PostgreSQLConnection
2020-11-07 17:22:16 +01:00
Benjamin Lévêque
d553750054 Allow user to override default options when extending the Choice Constraint
Co-authored-by: Maxime Steinhausser <maxime.steinhausser@gmail.com>
2020-11-07 17:03:44 +01:00
Robin Chalas
b8a5e48105 bug #39025 [DoctrineBridge] Fix DBAL deprecations in middlewares (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[DoctrineBridge] Fix DBAL deprecations in middlewares

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

Commits
-------

969da48c98 [DoctrineBridge] Fix DBAL deprecations in middlewares.
2020-11-07 15:51:28 +01:00
Robin Chalas
bc42cf604e [Messenger] Fix DBAL deprecations in PostgreSQLConnection 2020-11-07 15:49:46 +01:00
Alexander M. Turek
969da48c98 [DoctrineBridge] Fix DBAL deprecations in middlewares. 2020-11-07 15:21:55 +01:00
Alexander M. Turek
5c5b8d61ee Merge branch '5.1' into 5.x 2020-11-07 14:01:53 +01:00
Alexander M. Turek
8c81f33840 Merge branch '4.4' into 5.1 2020-11-07 14:01:26 +01:00
Fabien Potencier
be8fd560e3 minor #39017 [ProxyManagerBridge] replace ProxyManager\Version by feature detection (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[ProxyManagerBridge] replace ProxyManager\Version by feature detection

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

I'd like to get rid of this `Version` class, which is the source of so many issues with deps.
This won't remove the class from ocramius/proxy-manager, but that's a separate story that this change could enable in the end :)

Commits
-------

5f77aad6ca [ProxyManagerBridge] replace ProxyManager\Version by feature detection
2020-11-06 17:37:15 +01:00
Nicolas Grekas
5f77aad6ca [ProxyManagerBridge] replace ProxyManager\Version by feature detection 2020-11-06 15:18:27 +01:00
Alexander M. Turek
5e3338c1d7 minor #39009 [CI] Fix invalid Doctrine parameter syntax (Nyholm)
This PR was merged into the 4.4 branch.

Discussion
----------

[CI] Fix invalid Doctrine parameter syntax

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

~~I cannot reproduce locally.. So Im trying to fix this with the help of the CI~~

I have reproduced locally. This fix will help.

```
❯ phpunit Tests/Transport/DoctrineIntegrationTest.php
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

.E....                                                              6 / 6 (100%)

Time: 111 ms, Memory: 6.00 MB

There was 1 error:

1) Symfony\Component\Messenger\Bridge\Doctrine\Tests\Transport\DoctrineIntegrationTest::testSendWithDelay
Doctrine\DBAL\SQLParserUtilsException: Value for :body not found in params array. Params array key should be "body"

src/Symfony/Component/Messenger/Bridge/Doctrine/vendor/doctrine/dbal/src/SQLParserUtilsException.php:21
src/Symfony/Component/Messenger/Bridge/Doctrine/vendor/doctrine/dbal/src/SQLParserUtils.php:277
src/Symfony/Component/Messenger/Bridge/Doctrine/vendor/doctrine/dbal/src/SQLParserUtils.php:203
src/Symfony/Component/Messenger/Bridge/Doctrine/vendor/doctrine/dbal/src/Connection.php:1019
src/Symfony/Component/Messenger/Bridge/Doctrine/vendor/doctrine/dbal/src/Query/QueryBuilder.php:210
src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineIntegrationTest.php:66

ERRORS!
Tests: 6, Assertions: 8, Errors: 1.
```

Apply patch:

```
❯ phpunit Tests/Transport/DoctrineIntegrationTest.php
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

......                                                              6 / 6 (100%)

Time: 94 ms, Memory: 6.00 MB

OK (6 tests, 9 assertions)

```

Commits
-------

0ab3032c52 [CI] Fixed invalid doctrine parameter syntax
2020-11-05 22:19:20 +01:00
Nyholm
0ab3032c52
[CI] Fixed invalid doctrine parameter syntax 2020-11-05 21:54:48 +01:00
Robin Chalas
2c39acd159 fix merge 2020-11-05 21:41:09 +01:00
Alexander M. Turek
5f25a6f980 Merge branch '5.1' into 5.x 2020-11-05 21:05:54 +01:00
Alexander M. Turek
2081035295 Merge branch '4.4' into 5.1 2020-11-05 20:04:46 +01:00
Robin Chalas
75f8ac1e9b bug #38991 [Console] Fix ANSI when stdErr is not a tty (jderusse)
This PR was merged into the 4.4 branch.

Discussion
----------

[Console] Fix ANSI when stdErr is not a tty

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

Taking the @wouterj 's comment into account (https://github.com/symfony/symfony/issues/38981#issuecomment-721915428)

This PR prevents using the same Formatter for stdOut and stdErr when possible.

When user send a custom formatter (or call `setFormatter`) the previous logic is kept.
Otherwise, symfony is asked to create the Formatter, and thus is able to clone the formatter.

In a future PR targeting 5.3, we could improve the constructor to let people inject 2 distinguished formatters

Commits
-------

f3a398b5af Fix ANSI when stdErr is not a tty
2020-11-05 16:22:05 +01:00
Nicolas Grekas
61b3872b65 bug #38980 [DependencyInjection] Fix circular reference with Factory + Lazy Iterrator (jderusse)
This PR was merged into the 4.4 branch.

Discussion
----------

[DependencyInjection] Fix circular reference with Factory + Lazy Iterrator

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

The issue, occurs when a `factory` iterates over services (think tagged iterator) that also need the `factory`.
The PhpDumper is not able to detect the loop because the TaggedService iterator is flaged as "lazy" which is ignored in the loop detection. 2d7e0b02c6/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php (L474-L476)

See test case for a reproduce case.

This PR takes into account lazy services when computing loops.

I'm not sure this is the right thing to do /cc @nicolas-grekas .
A better solution could be to do this ONLY when the service is used as a factory?

Commits
-------

51ff060603 Fix circular referene with Factory and LazyIterator
2020-11-05 12:51:33 +01:00
Jérémy Derussé
f3a398b5af
Fix ANSI when stdErr is not a tty 2020-11-05 10:51:39 +01:00
Fabien Potencier
dc0d45d31a bug #38986 [DoctrineBridge] accept converting Uid-as-strings to db-values (nicolas-grekas)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[DoctrineBridge] accept converting Uid-as-strings to db-values

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

In #38605 I made Uid types stricter by taking inspiration from native Doctrine types. But https://github.com/symfony/symfony/issues/38929#issuecomment-720108301 made me realize this doesn't work with ParamConverters. Here is the fix.

Commits
-------

20714d66c9 [DoctrineBridge] accept converting Uid-as-strings to db-values
2020-11-05 09:48:15 +01:00
Nyholm
94818d2a22
minor #38995 [Security] Fix docblock (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Fix docblock

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

Commits
-------

60e506835a [Security] Fix docblock.
2020-11-05 09:37:17 +01:00
Alexander M. Turek
60e506835a [Security] Fix docblock. 2020-11-05 00:24:50 +01:00
Jérémy Derussé
51ff060603
Fix circular referene with Factory and LazyIterator 2020-11-04 15:21:44 +01:00
Nicolas Grekas
20714d66c9 [DoctrineBridge] accept converting Uid-as-strings to db-values 2020-11-04 12:11:20 +01:00
Fabien Potencier
57e39b41b9 feature #38850 [Messenger] Do not call getQueueUrl when the url is known in AmazonSqs transport (jderusse)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Messenger] Do not call getQueueUrl when the url is known in AmazonSqs transport

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

When user provides a DSN that looks like a queueUrl, we don't need to call the `getQueueUrl` method. This PR inject the known queueUrl and prevent performing a useless call to the API when sending a message

Commits
-------

f1f44d48e0 Do not call getQueueUrl when the url is known
2020-11-04 08:24:27 +01:00
Fabien Potencier
d2bac32525 feature #38940 [Messenger] Improve formatting of exception in failed message (Jeroen Noten)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Messenger] Improve formatting of exception in failed message

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | not really, enhancement of an existing feature
| Deprecations? | no
| Tickets       | Fix #32310
| License       | MIT

This PR improves the formatting of exception details in failed messenges when displayed using `messenger:failed:show <id> -vv`.

Before:
<img width="807" alt="Screen Shot 2020-11-01 at 1 05 24 PM" src="https://user-images.githubusercontent.com/4370753/97802602-ea593200-1c44-11eb-8bcb-7fcf2d3f1db0.png">

After:
<img width="803" alt="Screen Shot 2020-11-01 at 1 03 09 PM" src="https://user-images.githubusercontent.com/4370753/97802615-f0e7a980-1c44-11eb-8c12-46b2d4510364.png">

I created a `ThrownExceptionDetails` class which will be displayed as a normal exception when dumped with the VarDumper component. Not sure if this is the right way to do it and if the class is in the right namespace, but this is the best solution I could came up with to fix #32310. I'm open for other suggestions.

Commits
-------

2ad1adda69 [Messenger] Improve formatting of thrown exception in show failed message command
2020-11-04 08:21:06 +01:00
Fabien Potencier
6251c4ee6e feature #38954 [HttpFundation][FrameworkBundle] Deprecate the HEADER_X_FORWARDED_ALL constant (jderusse)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpFundation][FrameworkBundle] Deprecate the HEADER_X_FORWARDED_ALL constant

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

The `HEADER_X_FORWARDED_ALL` implicitly trust the `x-forwarded-host` header, leading to possible host header attack (as warned in the [documentation](https://symfony.com/doc/current/reference/configuration/framework.html#trusted-hosts).)

Moreover, this `HEADER_X_FORWARDED_ALL` does not really fowards **all** headers, as ti does not supports `X-Forwarded-Prefix` headers.

This PR deprecate the constant and the new framework bundle configuration. It will be removed in 6.0. People have to use: either:
- `Request::setTrustedProxies(['1.2.3.4'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);`
- `Request::setTrustedProxies(['1.2.3.4'], Request::HEADER_X_FORWARDED_TRAEFIK);`
- `framework.trusted_headers: [x-forwarded-for, x-forwarded-host, x-forwarded-port, x-forwarded-proto]`

Commits
-------

7cf4dd6917 Deprecate HEADER_X_FORWARDED_ALL constant
2020-11-04 08:16:55 +01:00
Nicolas Grekas
ff7ffdf22a bug #38977 [HttpClient] Check status code before decoding content in TraceableResponse (chalasr)
This PR was merged into the 5.1 branch.

Discussion
----------

[HttpClient] Check status code before decoding content in TraceableResponse

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

Using `toArray()` on the response of a traceable client, the status code is currently checked after json decoding, which leads to `JsonException` being thrown instead of `ClientException`.
It should be the opposite, as for non-traceable responses.

Commits
-------

e5595dae73 [HttpClient] Check status code before decoding content in TraceableResponse
2020-11-03 21:22:18 +01:00
Robin Chalas
e5595dae73 [HttpClient] Check status code before decoding content in TraceableResponse 2020-11-03 21:20:54 +01:00
Alexander M. Turek
e5ec20400c minor #38978 Rename security.pt_PT.xlf to security.pt.xlf (raziel057)
This PR was merged into the 4.4 branch.

Discussion
----------

Rename security.pt_PT.xlf to security.pt.xlf

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

Missing translations for Portuguese (pt).

As agreed in https://github.com/symfony/symfony/issues/38739#issuecomment-721210579 the common Portuguese translation file for security domain should be ``security.pt.xlf`` rather than ``security.pt_PT.xlf``

Commits
-------

3dd385f319 Rename security.pt_PT.xlf to security.pt.xlf
2020-11-03 20:16:45 +01:00
Thomas Lallement
3dd385f319
Rename security.pt_PT.xlf to security.pt.xlf 2020-11-03 17:58:31 +01:00
Jeroen Noten
2ad1adda69 [Messenger] Improve formatting of thrown exception in show failed message command 2020-11-03 13:22:22 +01:00
Nicolas Grekas
2d7e0b02c6 Merge branch '5.1' into 5.x
* 5.1:
  fix typo
2020-11-03 13:14:28 +01:00
Nicolas Grekas
4541862a12 Merge branch '4.4' into 5.1
* 4.4:
  fix typo
2020-11-03 13:14:22 +01:00
Nicolas Grekas
6fe261a7ae fix typo 2020-11-03 13:14:11 +01:00
Nicolas Grekas
1cfd3ab03a Merge branch '5.1' into 5.x
* 5.1:
  [PhpUnitBridge] fix replaying skipped tests
  Switch nightly run to 8.0snapshot
2020-11-03 12:59:38 +01:00
Nicolas Grekas
298422c844 Merge branch '4.4' into 5.1
* 4.4:
  [PhpUnitBridge] fix replaying skipped tests
  Switch nightly run to 8.0snapshot
2020-11-03 12:59:17 +01:00
Nicolas Grekas
703497dccf bug #38971 [PhpUnitBridge] fix replaying skipped tests (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] fix replaying skipped tests

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

Spotted while working on https://github.com/symfony/polyfill/pull/310

See also https://3v4l.org/D6Gro for the newly skipped tests in symfony/intl

Commits
-------

849d1b3845 [PhpUnitBridge] fix replaying skipped tests
2020-11-03 12:57:46 +01:00
Nicolas Grekas
849d1b3845 [PhpUnitBridge] fix replaying skipped tests 2020-11-03 12:50:26 +01:00
Fabien Potencier
e04777966a minor #38967 Switch nightly run to 8.0snapshot (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

Switch nightly run to 8.0snapshot

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

It's too early to test on php 8.1, so let's switch to 8.0 instead.

Commits
-------

b4730cbe1d Switch nightly run to 8.0snapshot
2020-11-03 07:19:11 +01:00
Jérémy Derussé
d658164b7f
minor #38941 [FrameworkBundle] Register AddErrorDetailsStampListener from the Messenger component as event subscriber (Jeroen Noten)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[FrameworkBundle] Register AddErrorDetailsStampListener from the Messenger component as event subscriber

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

This is a fix for a bug in version 5.2-BETA3.

In #32904, adding the error details to a failed message in the Messenger component was moved to a separate listener. However, this listener is not registered in the FrameworkBundle, resulting in no error details stored at all (when using the Symfony skeleton). This PR adds that missing registration.

Commits
-------

deda2ac411 [FrameworkBundle] Register AddErrorDetailsStampListener from the Messenger component as event subscriber
2020-11-03 01:02:05 +01:00
Jérémy Derussé
0dfbeb4e1e
minor #38842 [Notifier] Add unit tests for NullMessage, NullTransport and NullTransportFactory (jschaedl)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Notifier] Add unit tests for NullMessage, NullTransport and NullTransportFactory

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| 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 5.x.
-->

Commits
-------

8a78dc2c97 [Notifier] Add unit tests for NullMessage, NullTransport and NullTransportFactory
2020-11-03 00:56:53 +01:00
Jan Schädlich
8a78dc2c97
[Notifier] Add unit tests for NullMessage, NullTransport and NullTransportFactory 2020-11-03 00:54:11 +01:00
Alexander M. Turek
b4730cbe1d Switch nightly run to 8.0snapshot 2020-11-02 22:35:35 +01:00
Jérémy Derussé
7cf4dd6917
Deprecate HEADER_X_FORWARDED_ALL constant 2020-11-02 17:16:33 +01:00
Nicolas Grekas
6ddb93df1f Merge branch '5.1' into 5.x
* 5.1:
  [HttpKernel] fix merge
2020-11-02 17:09:19 +01:00
Nicolas Grekas
f0d9eeb257 Merge branch '4.4' into 5.1
* 4.4:
  [HttpKernel] fix merge
2020-11-02 17:09:08 +01:00
Nicolas Grekas
76c19393c8 [HttpKernel] fix merge 2020-11-02 17:06:19 +01:00