Commit Graph

50818 Commits

Author SHA1 Message Date
Fabien Potencier
f1f37a899c Fix CS 2020-09-12 10:28:26 +02:00
Fabien Potencier
a32fde9b9c feature #37829 [RFC][HttpKernel][Security] Allowed adding attributes on controller arguments that will be passed to argument resolvers. (jvasseur)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[RFC][HttpKernel][Security] Allowed adding attributes on controller arguments that will be passed to argument resolvers.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #29692
| License       | MIT
| Doc PR        | Not yet, will do it it this PR is accepted.

This PR allow to configure argument resolvers using PHP8 attributes.

This is basically a fix for #29692 but using a different strategy that the one proposed in the issue:
 - it uses PHP attributes instead of doctrine annotation since they can be added directly on method arguments.
 - it uses a simpler design by just adding the attribute to the `ArgumentMetadata` and let the individual resolvers decide if they want to react to the presence of the attribute.
 - it uses an attributes classe per use-case instead of an unique `Arg` annotation.

As an example, I've added (in the second commit) a `CurrentUser` attribute that allows the `UserValueResolver` to always inject the current user even if the argument is not typed with the `UserInterface` (to allow typing your actual class instead for example).

This would allow to do things like this:
```php
class MyController
{
    public function indexAction(#[CurentUser] MyUser $user)
    {
    }
}
```

Commits
-------

20f316906e [RFC][HttpKernel][Security] Allowed adding attributes on controller arguments that will be passed to argument resolvers.
2020-09-12 10:22:31 +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
Fabien Potencier
d7d479bb9f feature #37752 [RFC][lock] Introduce Shared Lock (or Read/Write Lock) (jderusse)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[RFC][lock] Introduce Shared Lock (or Read/Write Lock)

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

This PR adds a new method "acquireRead" to the Lock class in order to solve the [single writer multiple readers](https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock) problem.

usage:
```php
$aliceLock = $factory->createLock('invoice');
$bobLock = $factory->createLock('invoice');
$oscarLock = $factory->createLock('invoice');

$aliceLock->acquireRead(); // true
$bobLock->acquireRead(); // true
$oscarLock->acquire(); // false
```
## next steps

### add more stores

- pdo
- memcached
- zookeeper
- mongodb

### Priority policies

Priority policy (read-preffering or write preffering) is not covered by this PR.

## Promote/Demote

Converting a Read lock to Write Lock (promote) or Write lock to Read lock (demote) is covered by calling `acquireRead` / `acquired` method.
```php
// demote
$lock->acquire();
...
$lock->acquireRead();

// promote
$lock->acquireRead();
...
$lock->acquire();
```

Commits
-------

a7d51937f0 [RFC][lock] Introduce Shared Lock (or Read/Write Lock)
2020-09-12 07:27:09 +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
Fabien Potencier
021ba35434 Merge branch '5.1'
* 5.1:
  In the new authenticator system, no auth listener is valid
2020-09-12 07:03:09 +02:00
Fabien Potencier
393e5c4f4a feature #38160 [Security] In the new authenticator system, no auth listener is valid (weaverryan)
This PR was merged into the 5.1 branch.

Discussion
----------

[Security] In the new authenticator system, no auth listener is valid

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

In the new authenticator system, `anonymous` is gone and it IS now valid to have no authentication listeners. Before this PR, the following would trigger this error:

```
security:
    enable_authenticator_manager: true

    firewalls:
        main:
            lazy: true
```

But this IS valid (and would eventually be the "starting security.yaml" when the new system is the main system).

Cheers!

Commits
-------

6b520db2eb In the new authenticator system, no auth listener is valid
2020-09-12 06:45:27 +02:00
Ryan Weaver
6b520db2eb In the new authenticator system, no auth listener is valid 2020-09-11 12:48:24 -04: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
3a9b2d2fa0 Merge branch '4.4' into 5.1
* 4.4:
  [Cache] fix previous PR
2020-09-11 13:46:16 +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
Fabien Potencier
899d60c24c minor #38157 [Validator] Add missing Serbian (sr_Latn & sr_Cyrl) translations (tambait)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Add missing Serbian (sr_Latn & sr_Cyrl) translations

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        | none
<!--
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
-------

e927c7cf69 add mising sr (latn & cyrl) translations
2020-09-11 11:38:00 +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
Fabien Potencier
7192d29efc feature #38151 [Serializer] add UidNormalizer (guillbdx, norkunas)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Serializer] add UidNormalizer

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

UUID and ULID normalizer.

Continuation of #36406

Commits
-------

d6a899395b Update based on feedback
1c21c78d25 UidNormalizer.
2020-09-11 07:18:48 +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
Fabien Potencier
0aae1b491c feature #37976 [Messenger] Don't prevent dispatch out of another bus (ogizanagi)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Messenger] Don't prevent dispatch out of another bus

| 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       | https://github.com/symfony/symfony/issues/35814#issuecomment-682433541 <!-- 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
-------

1e8ae43372 [Messenger] Don't prevent dispatch out of another bus
2020-09-10 19:13:48 +02:00
Maxime Steinhausser
1e8ae43372 [Messenger] Don't prevent dispatch out of another bus 2020-09-10 19:13:35 +02:00
Fabien Potencier
0f704c947d bug #38131 [Validator] allow consumers to mock all methods (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] allow consumers to mock all methods

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

Commits
-------

3227303dab allow consumers to mock all methods
2020-09-10 19:02:04 +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
Nicolas Grekas
e8dc35dc2d bug #38126 [Cache] Limit cache version character range (lstrojny)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Cache] Limit cache version character range

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

Follow up for https://github.com/symfony/symfony/pull/38108

With current HEAD in 4.4, this will fail eventually: `simple-phpunit --repeat 1000 --stop-on-failure --filter "testGetMultiple$" src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTextModeTest.php`

After this PR it will no longer fail

@nicolas-grekas

Commits
-------

15c21db856 [Cache] Limit cache version character range
2020-09-10 18:48:32 +02:00