Commit Graph

51429 Commits

Author SHA1 Message Date
gary houbre
449147bc17 Added Invalid constant into Command Class 2020-11-23 16:56:49 +01:00
Fabien Potencier
1d445cce63 Merge branch '5.1' into 5.x
* 5.1:
  [Messenger][Doctrine] Avoid early db access for pgsql detection
  Add missing use statement
2020-10-19 08:28:41 +02:00
Fabien Potencier
4fdacdb3a3 bug #38618 [Messenger][Doctrine] Avoid early db access for pgsql detection (chalasr)
This PR was merged into the 5.1 branch.

Discussion
----------

[Messenger][Doctrine] Avoid early db access for pgsql detection

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

Keeps the connection lazy using an instanceof check on the DBAL driver instead.

Commits
-------

c4cc4a338b [Messenger][Doctrine] Avoid early db access for pgsql detection
2020-10-19 08:27:35 +02:00
Alexander M. Turek
2702d81499 bug #38623 [HttpFoundation][RateLimiter] fix RequestRateLimiterInterface::reset() (kbond)
This PR was merged into the 5.x branch.

Discussion
----------

[HttpFoundation][RateLimiter] fix RequestRateLimiterInterface::reset()

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

The reset method requires the `$request`.

Commits
-------

a246894a00 fix RequestRateLimiterInterface::reset()
2020-10-19 00:34:45 +02:00
Kevin Bond
a246894a00
fix RequestRateLimiterInterface::reset() 2020-10-18 18:14:51 -04:00
Robin Chalas
c4cc4a338b [Messenger][Doctrine] Avoid early db access for pgsql detection 2020-10-18 02:19:48 +02:00
Fabien Potencier
fdf9a43433 bug #38605 [DoctrinBridge] make Uid types stricter (nicolas-grekas)
This PR was merged into the 5.x branch.

Discussion
----------

[DoctrinBridge] make Uid types stricter

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

Reviewing #38600 made me realize we don't need to deal with converting strings to db values.
We should only support converting actual `AbstractUid` instances in the DB.
Also, the binary types should *not* extend `GuidType`.

Commits
-------

ba31d0ee59 [DoctrinBridge] make Uid types stricter
2020-10-17 07:39:20 +02:00
Nicolas Grekas
ba31d0ee59 [DoctrinBridge] make Uid types stricter 2020-10-16 18:51:00 +02:00
Grégoire Pineau
6088728c5e bug #38602 [Console] Fix signal management (chalasr)
This PR was merged into the 5.x branch.

Discussion
----------

[Console] Fix signal management

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

Missed in #38589

Commits
-------

36e41b85d8 [Console] Fix Application::getSignalRegistry() retval
2020-10-16 15:19:45 +02:00
Nicolas Grekas
5ca43b855f bug #38600 [DoctrineBridge] Convert values to Rfc4122 before inserting them into the database (Kai)
This PR was squashed before being merged into the 5.x branch.

Discussion
----------

[DoctrineBridge] Convert values to Rfc4122 before inserting them into the database

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| 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 #38599
| License       | MIT

This PR formats the ULID into RFC4211 before inserting it into the database to avoid insertion failure on Postgres due to not recognized formating.

Commits
-------

fd3a6e8a0a [DoctrineBridge] Convert values to Rfc4122 before inserting them into the database
2020-10-16 15:08:56 +02:00
Kai
fd3a6e8a0a [DoctrineBridge] Convert values to Rfc4122 before inserting them into the database 2020-10-16 15:08:47 +02:00
Robin Chalas
36e41b85d8 [Console] Fix Application::getSignalRegistry() retval 2020-10-16 14:43:44 +02:00
Fabien Potencier
abbb3d0546 feature #38562 [RateLimiter] Added reserve() to LimiterInterface and rename Limiter to RateLimiter (wouterj)
This PR was squashed before being merged into the 5.x branch.

Discussion
----------

[RateLimiter] Added reserve() to LimiterInterface and rename Limiter to RateLimiter

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

While Javier wrote documentation for this new component, we found a couple of confusing elements that might need some tweaks:

* The `Limiter` class (previously called `LimiterFactory`) has imho a bit strange name, as it's not a limiter and it doesn't implement `LimiterInterface`. It can only new limiters. I believe `LimiterFactory` - like `LockFactory` - would be the most clear, but as that was rejected before, here is another proposal using `RateLimiter`.
* `reserve()` was now only part of the token bucket implementation. That made it a bit less useful. I think I've found a way to also allow reserving future hits in the fixed window implementation, so I've moved it to the `LimiterInterface`.

Commits
-------

cd34f21254 [RateLimiter] Added reserve() to LimiterInterface and rename Limiter to RateLimiter
2020-10-16 07:10:35 +02:00
Wouter de Jong
cd34f21254 [RateLimiter] Added reserve() to LimiterInterface and rename Limiter to RateLimiter 2020-10-16 07:10:27 +02:00
Fabien Potencier
6e4d6eb2dd feature #38593 [Lock][Semaphore] Add Factory::createFromKey and deprecate lock.store services (jderusse)
This PR was merged into the 5.x branch.

Discussion
----------

[Lock][Semaphore] Add Factory::createFromKey and deprecate lock.store services

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

The `lock` service and aliases have been deprecated in #38576. This PR also deprecate the `lock.store` service and aliases.

People should always inject the factory into their services, except for one scenario: When they want building the `Lock` manually because they want to keep the key.

This scenario require declaring `lock.store` service and `PersisingStoreInterface` aliases.
This could be avoided if people had a method to create a lock from a given key.

This PR adds a `LockFactory::createFromKey()` method and deprecate all `lock.store` services

I also updated the Semaphore component for consistency, and helping people to only inject the SemahoreFactory.

nb: use cases for serializing the keys:
- Netflix allows only 5 users of the same family at the same time.
- An holiday apartment rental avoid users putting the same apartment in the basket
- ...

Commits
-------

91fa3e311d Deprecate lock.store aliases
2020-10-16 07:05:54 +02:00
Fabien Potencier
72be3057ca feature #38587 [HttpClient] added extra.trace_content option to TraceableHttpClient to prevent it from keeping the content in memory (nicolas-grekas)
This PR was merged into the 5.x branch.

Discussion
----------

[HttpClient] added `extra.trace_content` option to `TraceableHttpClient` to prevent it from keeping the content in memory

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

`TraceableHttpClient` leaks memory by definition. But sometimes, this leak is to important, especially when keeping the response content in memory.

This PR adds a new `trace_content` option under `extra` so that consumers can tell the client to not trace the content. This will be ignored when `TraceableHttpClient` is not in use.

Commits
-------

61290d5aa4 [HttpClient] added `extra.trace_content` option to `TraceableHttpClient` to prevent it from keeping the content in memory
2020-10-16 06:59:05 +02:00
Fabien Potencier
c61f65778d bug #38580 [FrameworkBundle] fix config declaration of http_cache option (nicolas-grekas)
This PR was merged into the 5.x branch.

Discussion
----------

[FrameworkBundle] fix config declaration of http_cache option

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

Addresses comments from @stof in https://github.com/symfony/symfony/pull/37351#pullrequestreview-438314002

Commits
-------

2514cf1c1d [FrameworkBundle] fix config declaration of http_cache option
2020-10-16 06:55:53 +02:00
Fabien Potencier
dda1fe9c3a bug #38589 [Console] Don't register signal handlers if pcntl is disabled (chalasr)
This PR was merged into the 5.x branch.

Discussion
----------

[Console] Don't register signal handlers if pcntl is disabled

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

This PR skips the default signal registration when pcntl is not installed or disabled via the `disable_functions` INI directive (which is common for prod infrastructures).
When registering a `SignalableCommand`, a clear exception is thrown.

Best reviewed [without whitespaces](https://github.com/symfony/symfony/pull/38589/files?w=1)

Commits
-------

8fe876341e [Console] Don't register signal handlers if pcntl is disabled
2020-10-16 06:52:38 +02:00
Robin Chalas
8fe876341e [Console] Don't register signal handlers if pcntl is disabled 2020-10-16 01:46:35 +02:00
Jérémy Derussé
91fa3e311d
Deprecate lock.store aliases 2020-10-15 22:19:33 +02:00
Alexander M. Turek
ab7f4899e9 minor #38584 [FrameworkBundle] Missing Changelog for deprecating services (jderusse)
This PR was merged into the 5.x branch.

Discussion
----------

[FrameworkBundle] Missing Changelog for deprecating services

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

I forgot to add CHANGELOG/UPGRADE when deprecating alias `lock` in #38576. (thank you  @nicolas-grekas for reminding this)

This PR also adds a missing alias registered for argument.

Commits
-------

f9ddc5c147 Missing Changelog for deprecating services
2020-10-15 21:25:34 +02:00
Nyholm
1e8916904e
bug #38581 [Semaphore] Reset Key lifetime time before we acquire it (jderusse)
This PR was merged into the 5.x branch.

Discussion
----------

[Semaphore] Reset Key lifetime time before we acquire it

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

This is the same issue fixed by #38553 but for Semaphore component.

Commits
-------

e7ffd5d2e7 Reset Key lifetime time in semaphore
2020-10-15 19:46:28 +02:00
Jérémy Derussé
e7ffd5d2e7
Reset Key lifetime time in semaphore 2020-10-15 19:25:55 +02:00
Nicolas Grekas
61290d5aa4 [HttpClient] added extra.trace_content option to TraceableHttpClient to prevent it from keeping the content in memory 2020-10-15 14:02:47 +02:00
Jérémy Derussé
f9ddc5c147
Missing Changelog for deprecating services 2020-10-15 11:48:15 +02:00
Nicolas Grekas
2514cf1c1d [FrameworkBundle] fix config declaration of http_cache option 2020-10-15 10:20:12 +02:00
Alexander M. Turek
b3a1851d43 minor #38579 Fix: Typo (OskarStark)
This PR was merged into the 5.x branch.

Discussion
----------

Fix: Typo

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

Commits
-------

db392d2441 Fix: Typo
2020-10-15 10:18:29 +02:00
Oskar Stark
db392d2441
Fix: Typo 2020-10-15 10:06:30 +02:00
Fabien Potencier
19a320513a feature #38565 [RateLimiter] Adding SlidingWindow algorithm (Nyholm)
This PR was squashed before being merged into the 5.x branch.

Discussion
----------

[RateLimiter] Adding SlidingWindow algorithm

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

This is a draft PR to make sure we like the idea. I'll keep working on adding tests.

Commits
-------

c6d3b70315 [RateLimiter] Adding SlidingWindow algorithm
2020-10-15 08:59:52 +02:00
Nyholm
c6d3b70315 [RateLimiter] Adding SlidingWindow algorithm 2020-10-15 08:59:46 +02:00
Fabien Potencier
5bc26de767 feature #38576 Deeprecate lock service (jderusse)
This PR was merged into the 5.x branch.

Discussion
----------

Deeprecate lock service

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

This PR deprecate the `lock`, `LockInterface` service ass discussed in #38458

Commits
-------

40ea90ef6b Deeprecate lock service
2020-10-15 06:50:32 +02:00
Fabien Potencier
6bbab591c8 bug #38578 Add missing use statement (jderusse)
This PR was merged into the 5.1 branch.

Discussion
----------

Add missing use statement

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

The `StoreInterface` has been renamed into `PersistingStoreInterface` in 4.4, but people are allowed to use an old version of the Lock component with a recent version of the FrameworkBundle.

The StoreInterface is used here:
3e587d7013/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php (L1582)

Commits
-------

4a63308fb3 Add missing use statement
2020-10-15 06:48:07 +02:00
Jérémy Derussé
4a63308fb3
Add missing use statement 2020-10-15 01:12:09 +02:00
Jérémy Derussé
40ea90ef6b
Deeprecate lock service 2020-10-15 01:04:22 +02:00
Fabien Potencier
8c4ecc313b Bump Symfony version to 5.2.0 2020-10-14 21:27:47 +02:00
Fabien Potencier
546907b087
Merge pull request #38573 from fabpot/release-5.2.0-BETA2
released v5.2.0-BETA2
2020-10-14 21:22:41 +02:00
Fabien Potencier
0641541f34 Update VERSION for 5.2.0-BETA2 2020-10-14 21:22:19 +02:00
Fabien Potencier
1b4a2afabf Update CHANGELOG for 5.2.0-BETA2 2020-10-14 21:22:09 +02:00
Fabien Potencier
a428b011b3 feature #38552 [Security][Notifier] Added integration of Login Link with the Notifier component (wouterj)
This PR was squashed before being merged into the 5.x branch.

Discussion
----------

[Security][Notifier] Added integration of Login Link with the Notifier component

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

This adds a `LoginLinkNotification` that uses the `NotificationEmail` and integrates with the notifier component. This makes it much easier to use the login link functionality, as it provides a default email and sms implementation.

```php
class AuthController extends AbstractController
{
    /** @Route("/login", name="login") */
    public function login(LoginLinkHandlerInterface $loginLinkHandler, UserRepository $userRepository, Request $request, NotifierInterface $notifier)
    {
        if (!$request->isMethod('POST')) {
            return $this->redirect('/');
        }

        $user = $userRepository->findOneBy(['email' => $request->get('email')]);
        if (!$user) {
            return new Response('User not found');
        }

        $loginLink = $loginLinkHandler->createLoginLink($user);
        $notifier->send(new LoginLinkNotification($loginLink, 'Welcome to ACME!'), new Recipient($user->getEmail()));

        return new Response('Login link send!');
    }

    /** @Route("/login/check", name="check_login") */
    public function loginCheck()
    {
        throw new \BadMethodCallException();
    }
}
```

![image](https://user-images.githubusercontent.com/749025/95884718-be9d0780-0d7c-11eb-88ff-36b6b3108ca6.png)

---

The `NotificationEmail` is slightly changed, to allow bypassing the logging-related functionality. Also, @weaverryan suggested to remove the "created by Symfony" footer as this email is meant to be sent to all users of a service.

Commits
-------

04ef565895 [Security][Notifier] Added integration of Login Link with the Notifier component
2020-10-14 20:49:35 +02:00
Wouter de Jong
04ef565895 [Security][Notifier] Added integration of Login Link with the Notifier component 2020-10-14 20:49:27 +02:00
Nicolas Grekas
ffbb9883bd Merge branch '5.1' into 5.x
* 5.1:
  [Contracts] add branch-aliases for dev-main
  [Cache] Make Redis initializers static
  [Messenger] Fixed typos in Connection
  [CI] Fixed build on AppVeyor
  Fix tests typo
  [Lock] Reset Key lifetime time before we acquire it
  [CI] Silence errors when remove file/dir on test tearDown()
  Fix tests
  Remove content-type check on toArray methods
2020-10-14 19:08:19 +02:00
Nicolas Grekas
3e587d7013 Merge branch '4.4' into 5.1
* 4.4:
  [Contracts] add branch-aliases for dev-main
  [Cache] Make Redis initializers static
  Fix tests typo
  [Lock] Reset Key lifetime time before we acquire it
  [CI] Silence errors when remove file/dir on test tearDown()
2020-10-14 18:43:39 +02:00
Nicolas Grekas
6ba6ae75e0 minor #38571 [Contracts] add branch-aliases for dev-main (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[Contracts] add branch-aliases for dev-main

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

symfony/contracts is still using a "main" branch so we need to alias it for composer to know which version this maps to.

Commits
-------

969f3c217b [Contracts] add branch-aliases for dev-main
2020-10-14 18:24:00 +02:00
Nicolas Grekas
8553361a10 bug #38566 Fix minor issue when sharing windows between Limiters (Nyholm)
This PR was squashed before being merged into the 5.x branch.

Discussion
----------

Fix minor issue when sharing windows between Limiters

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

If I start using my custom Limiter, then change back to `FixedWindowLimiter`, then my cache might contain a value that `FixedWindowLimiter` does not support.

This PR makes sure that we handle such switch.

Commits
-------

e9ac9712d8 Fix minor issue when sharing windows between Limiters
2020-10-14 18:23:07 +02:00
Nyholm
e9ac9712d8 Fix minor issue when sharing windows between Limiters 2020-10-14 18:22:58 +02:00
Nicolas Grekas
969f3c217b [Contracts] add branch-aliases for dev-main 2020-10-14 17:23:35 +02:00
Fabien Potencier
2d5c2cf287 feature #38563 [Messenger][Redis] Adding support for lazy connect (Nyholm)
This PR was squashed before being merged into the 5.x branch.

Discussion
----------

[Messenger][Redis] Adding support for lazy connect

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #38558
| License       | MIT
| Doc PR        | Should be added

With inspiration from the CacheComponent. This PR makes it possible to make the connection to Redis only when you first use it.

Commits
-------

1d7c8013e6 [Messenger][Redis] Adding support for lazy connect
2020-10-14 16:11:47 +02:00
Nyholm
1d7c8013e6 [Messenger][Redis] Adding support for lazy connect 2020-10-14 16:11:38 +02:00
Fabien Potencier
a590e90698 minor #38567 [Cache] Make Redis initializers static (Nyholm)
This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] Make Redis initializers static

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

I am on very thin ice now. I saw a comment on similar code here: https://github.com/symfony/symfony/pull/38563#discussion_r504600024

These anonymous functions in the cache component could also be made static to avoid being connected to the object using the Redis trait.

Feel free to correct me if this does not make much sense.

Commits
-------

ad8de57b91 [Cache] Make Redis initializers static
2020-10-14 16:09:22 +02:00
Nyholm
ad8de57b91
[Cache] Make Redis initializers static 2020-10-14 13:43:26 +02:00