Commit Graph

46303 Commits

Author SHA1 Message Date
Christian Flothmann
b01a10c760 prevent deprecation being triggered from assertion 2020-03-01 20:15:08 +01:00
Nicolas Grekas
da0e2f94bb bug #35870 [ErrorHandler] fix parsing static return type on interface method annotation (alekitto)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] fix parsing static return type on interface method annotation

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

As suggested in the issue, the regex has been adapted to capture the return type, then it will be checked while determining if the method to be implemented should be static or just returns an instance of `static`.

Commits
-------

55734a297f [ErrorHandler] fix parsing static return type on interface method annotation (fix #35836)
2020-02-26 17:55:50 +01:00
Alessandro Chitolina
55734a297f
[ErrorHandler] fix parsing static return type on interface method annotation (fix #35836) 2020-02-26 12:45:31 +01:00
Robin Chalas
3057c68b93 Merge branch '3.4' into 4.4
* 3.4:
  [Security] Allow switching to another user when already switched
2020-02-26 11:27:30 +01:00
Nicolas Grekas
6f95125a09 bug #35839 [Security] Allow switching to another user when already switched (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Allow switching to another user when already switched

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

Commits
-------

0353077083 [Security] Allow switching to another user when already switched
2020-02-26 10:44:17 +01:00
Robin Chalas
0353077083 [Security] Allow switching to another user when already switched 2020-02-26 04:23:24 +01:00
Nicolas Grekas
1b377a86db Merge branch '3.4' into 4.4
* 3.4:
  [FrameworkBundle] Fix test
2020-02-25 15:33:04 +01:00
Nicolas Grekas
159ef1bf1d [FrameworkBundle] Fix test 2020-02-25 15:31:47 +01:00
Nicolas Grekas
1107548146 Merge branch '3.4' into 4.4
* 3.4:
  minor #35833 [FrameworkBundle] Add missing items in the unused tag pass whitelist (fabpot)
  [Validator] Add missing translations
2020-02-25 15:19:32 +01:00
Nicolas Grekas
b515bc9a97 minor #35833 [FrameworkBundle] Add missing items in the unused tag pass whitelist (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

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

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

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

Commits
-------

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

Discussion
----------

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

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

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

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

Commits
-------

06539173e7 [HttpClient][DX] Add URL context to JsonException messages
2020-02-25 14:55:46 +01:00
Jérôme TAMARELLE
06539173e7 [HttpClient][DX] Add URL context to JsonException messages 2020-02-25 14:55:11 +01:00
Fabien Potencier
8a678f6679 minor #35819 [Messenger] Use Doctrine DBAL new Types::* constants (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

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

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

Commits
-------

f1fb1597ff [Messenger] Use Doctrine DBAL new Types::* constants
2020-02-25 14:05:06 +01:00
Nicolas Grekas
ef95f2ecbc minor #35855 [Routing] Improve localized routes performances (mtarld)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing] Improve localized routes performances

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

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

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

Commits
-------

8e9eafe18b [Routing] Improve localized routes performances
2020-02-25 13:47:10 +01:00
Fabien Potencier
88b96abe04 bug #35851 [4.4][DoctrineBridge] Use new Types::* constants and support new json types (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[4.4][DoctrineBridge] Use new Types::* constants and support new json types

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

Commits
-------

ddf33535d0 [4.4][DoctrineBridge] Use new Types::* constants and support new json type
2020-02-25 13:46:09 +01:00
Mathias Arlaud
8e9eafe18b [Routing] Improve localized routes performances 2020-02-25 13:41:09 +01:00
Thomas Calvet
ddf33535d0 [4.4][DoctrineBridge] Use new Types::* constants and support new json type 2020-02-24 18:16:47 +01:00
Fabien Potencier
d7250ef620 [Validator] Add missing translations 2020-02-24 18:16:32 +01:00
Nicolas Grekas
1024f5fc10 bug #35716 [PhpUnitBridge] Fix compatibility to PHPUnit 9 (Benjamin)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Fix compatibility to PHPUnit 9

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

Adding the possibility to use PHPUnit 9.

Commits
-------

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

Discussion
----------

[Cache] Fix versioned namespace atomic clears

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

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

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

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

Commits
-------

971b177d27 Fix versioned namespace clears
2020-02-24 15:49:35 +01:00
Nicolas Grekas
2d53ff64c9 Merge branch '3.4' into 4.4
* 3.4:
  [DoctrineBridge] Use new Types::* constants and support new json type
2020-02-24 15:14:40 +01:00
Nicolas Grekas
9819814a8a bug #35817 [3.4][DoctrineBridge] Use new Types::* constants and support new json type (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

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

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

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

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

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

Commits
-------

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

Discussion
----------

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

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

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

Commits
-------

83d4aa7683 [Debug][ErrorHandler] improved deprecation notices for methods new args and return type
2020-02-24 10:54:50 +01:00
Nicolas Grekas
f75be008bc minor #35816 [Validator] Remove specific check for Valid targets (ogizanagi)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Remove specific check for Valid targets

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

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

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

Commits
-------

0086562c77 [Validator] Remove specific check for Valid targets
2020-02-23 22:17:02 +01:00
Jules Pietri
83d4aa7683
[Debug][ErrorHandler] improved deprecation notices for methods new args and return type 2020-02-23 15:41:43 +01:00
Nicolas Grekas
d28a738c6f bug #35827 [BrowserKit] Nested file array prevents uploading file (afilina)
This PR was merged into the 4.4 branch.

Discussion
----------

[BrowserKit] Nested file array prevents uploading file

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

The HttpBrowser doesn't play nicely with Symfony\Component\DomCrawler::getPhpFiles().
The former assumes a flat array structure, while the latter explicitly un-flattens it, causing files to silently get ignored by the DomCrawler's submitForm.

Commits
-------

e15f05e03f [BrowserKit] Nested file array prevents uploading file
2020-02-23 11:15:24 +01:00
Anna Filina
e15f05e03f [BrowserKit] Nested file array prevents uploading file 2020-02-23 11:00:59 +01:00
Fabien Potencier
1676e3a317 bug #35707 [ExpressionLanguage] Fixed collisions of character operators with object properties (Andrej-in-ua)
This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[ExpressionLanguage] Fixed collisions of character operators with object properties

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

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

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

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

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

Commits
-------

4b83ae7547 [ExpressionLanguage] Fixed collisions of character operators with object properties
2020-02-23 09:43:32 +01:00
Andrey Sevastianov
4b83ae7547 [ExpressionLanguage] Fixed collisions of character operators with object properties 2020-02-23 09:43:25 +01:00
Maxime Steinhausser
0086562c77 [Validator] Remove specific check for Valid targets 2020-02-21 16:29:16 +01:00
Fabien Potencier
643f34ff59 bug #35794 [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

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

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

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

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

Commits
-------

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

Discussion
----------

[PhpUnitBridge] Use trait instead of extending deprecated class

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

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

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

Commits
-------

034e1de6e6 [PhpUnitBridge] Use trait instead of extending deprecated class
2020-02-21 09:01:59 +01:00
Marcello Mönkemeyer
034e1de6e6 [PhpUnitBridge] Use trait instead of extending deprecated class 2020-02-21 09:01:47 +01:00
Trevor North
971b177d27 Fix versioned namespace clears
When using namespace versioning to achieve atomic cache clears, only
delete cache keys matching the old/current version.

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

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

Discussion
----------

Use strict assertSame instead of assertEquals in Asset component tests

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

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

~~Also, removing useless string cast.~~

Commits
-------

e8f3e84959 Use strict assertion in asset tests
2020-02-20 14:39:53 +01:00
Robin Chalas
aa3637db6f bug #35792 [Security] Prevent TypeError in case RememberMetoken has no attached user (nikophil)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Prevent TypeError in case RememberMetoken has no attached user

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

Commits
-------

3515793cb3 fix remember me
2020-02-20 13:14:22 +01:00
Nicolas PHILIPPE
3515793cb3 fix remember me 2020-02-20 11:24:12 +01:00
Jérôme TAMARELLE
e8f3e84959 Use strict assertion in asset tests 2020-02-20 09:19:58 +01:00
Fabien Potencier
88b89c9b45 bug #35735 [Routing] Add locale requirement for localized routes (mtarld)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing] Add locale requirement for localized routes

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

4.4 version of https://github.com/symfony/symfony/pull/35692

If you're using localized routes, you expect to have these kind of routes available:
- `/fr/accueil`
- `/en/home`

But nowadays, these routes are unexpectedly available:
- `/en/accueil`
- `/fr/home`

When importing routes like that:
- `prefix: "/{_locale}"`
- `@Route({"en": "/home", "fr": "/accueil"}, name="home")`

This PR proposes to add a strict locale requirement for localized so that the above routes won't be available.

Commits
-------

50d744589e [Routing] Add locale requirement for localized routes
2020-02-20 09:00:36 +01:00
Thomas Calvet
018ec1ae5c [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types 2020-02-19 23:15:50 +01:00
Nicolas Grekas
212841b3e6 bug #35772 [Config] don't throw on missing excluded paths (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Config] don't throw on missing excluded paths

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

Commits
-------

2f65a7a255 [Config] don't throw on missing excluded paths
2020-02-19 18:19:43 +01:00
Nicolas Grekas
a81cbc99c7 bug #35774 [Ldap] force default network timeout (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Ldap] force default network timeout

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

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

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

Commits
-------

63f9e013a1 [Ldap] force default network timeout
2020-02-19 17:02:56 +01:00
Nicolas Grekas
7225a01bc6 minor #35786 Do not rely on the current locale when dumping a Graphviz object (lyrixx)
This PR was merged into the 3.4 branch.

Discussion
----------

Do not rely on the current locale when dumping a Graphviz object

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

---

Funny bug !

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

(so external tools like graphviz could not parse `0,5` - and so skipped the arrow)

So now we force `'0.5'`

/cc @OskarStark

Commits
-------

094e4bbbc2 Do not rely on the current locale when dumping a Graphviz object
2020-02-19 16:50:34 +01:00
Grégoire Pineau
094e4bbbc2 Do not rely on the current locale when dumping a Graphviz object
Funny bug !

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

So now we force `'0.5'`
2020-02-19 15:50:10 +01:00
Robin Chalas
1c24ccc635 fix typo 2020-02-18 22:48:57 +01:00
Nicolas Grekas
63f9e013a1 [Ldap] force default network timeout 2020-02-18 14:07:02 +01:00
Nicolas Grekas
2f65a7a255 [Config] don't throw on missing excluded paths 2020-02-18 12:18:14 +01:00