Commit Graph

48628 Commits

Author SHA1 Message Date
Nicolas Grekas
95becc4078 bug #36457 [Cache] CacheItem with tag is never a hit after expired (alexander-schranz, nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] CacheItem with tag is never a hit after expired

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

It seems like a tag cacheItem is never a hit again. Not sure how fix this but the cache component is really hard to debug 🙈 .

It need to be somewhere generally as all TagAware caches are effected:

```
1) Symfony\Component\Cache\Tests\Adapter\FilesystemTagAwareAdapterTest::testRefreshAfterExpires

Failed asserting that false is true.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:194

2) Symfony\Component\Cache\Tests\Adapter\PredisTagAwareClusterAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183

3) Symfony\Component\Cache\Tests\Adapter\RedisTagAwareAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183

4) Symfony\Component\Cache\Tests\Adapter\RedisTagAwareClusterAdapterTest::testRefreshAfterExpires

Failed asserting that true is false.

/home/travis/build/symfony/symfony/src/Symfony/Component/Cache/Tests/Traits/TagAwareTestTrait.php:183
```

Commits
-------

d082eca7dd Add reproducer to for hit after update expire cacheItem
f815b011c3 [Cache] fix FilesystemTagAwareAdapter failing when a tag link preexists
2020-04-19 21:54:45 +02:00
Nicolas Grekas
8f9ff4f7a0 [Routing] fix CS 2020-04-19 19:10:00 +02:00
Nicolas Grekas
69b6c90330 Merge branch '5.0'
* 5.0:
  [HttpFoundation] workaround PHP bug in the session module
  [SecurityBundle] fix accepting env vars in remember-me configurations
  [Form] Fixed handling groups sequence validation
  [Mime] Ensure proper line-ending for SMIME
  [Cache] Avoid memory leak in TraceableAdapter::reset()
2020-04-18 22:50:29 +02:00
Nicolas Grekas
efbe752918 Merge branch '4.4' into 5.0
* 4.4:
  [HttpFoundation] workaround PHP bug in the session module
  [SecurityBundle] fix accepting env vars in remember-me configurations
  [Form] Fixed handling groups sequence validation
  [Cache] Avoid memory leak in TraceableAdapter::reset()
2020-04-18 22:50:06 +02:00
Nicolas Grekas
e0e3cf634e Merge branch '3.4' into 4.4
* 3.4:
  [HttpFoundation] workaround PHP bug in the session module
2020-04-18 22:40:08 +02:00
Nicolas Grekas
62565a1b66 bug #36490 [HttpFoundation] workaround PHP bug in the session module (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpFoundation] workaround PHP bug in the session module

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

Current tests fail after https://github.com/php/php-src/pull/5305
Which itself is a patch for a bug in the session module.

This PR works around the issue in older versions of PHP and fixes the tests.

Commits
-------

0cbca19edc [HttpFoundation] workaround PHP bug in the session module
2020-04-18 22:39:13 +02:00
Nicolas Grekas
0cbca19edc [HttpFoundation] workaround PHP bug in the session module 2020-04-18 22:23:17 +02:00
Nicolas Grekas
23f5070696 minor #36485 [Security] Fixed broken master build (wouterj)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Security] Fixed broken master build

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

The build failures are caused by these lines (line 100 specically):

2460ca59af/src/Symfony/Component/Security/Http/Firewall/ContextListener.php (L97-L108)

Since #34363, `$request->cookies->get()` is typehinted as `string|null`. On Travis with PHP=7.4, this doc typehint is transformed into PHP return type: `get(): ?string`.

On tests, the session cookie is set to `true`. See #36118 for some background on why this is necessary.

There are a couple possible solutions:

1. Update the `InputBag::get()` PHPdoc to use `@return scalar|null`
2. Use `$request->cookie->all()[$session->getName()]` in `ContextListener`
3. Allow pre-configuring the session ID in `MockArraySessionStorage`.

I've implemented solution (1). The method is actually using `is_scalar()` to check if a deprecation notice should be triggered, so it is expected to return a scalar in Symfony 6.

_I've had to update the `DebugClassLoader` to not convert this to `get(): ?scalar`, as that doesn't exists in PHP. I'm not sure if my changes are correct (but they work)._

Commits
-------

94f47630ba Fixed fetching sessionId from InputBag
2020-04-18 21:15:36 +02:00
Wouter de Jong
94f47630ba Fixed fetching sessionId from InputBag 2020-04-18 20:51:12 +02:00
Alexander Schranz
d082eca7dd Add reproducer to for hit after update expire cacheItem 2020-04-18 16:28:10 +02:00
Nicolas Grekas
f815b011c3 [Cache] fix FilesystemTagAwareAdapter failing when a tag link preexists 2020-04-18 16:28:10 +02:00
Nicolas Grekas
80c5060401 Merge branch '3.4' into 4.4
* 3.4:
  [SecurityBundle] fix accepting env vars in remember-me configurations
  [Form] Fixed handling groups sequence validation
  [Cache] Avoid memory leak in TraceableAdapter::reset()
2020-04-18 14:50:46 +02:00
Nicolas Grekas
a347a84453 bug #36483 [SecurityBundle] fix accepting env vars in remember-me configurations (zek)
This PR was merged into the 3.4 branch.

Discussion
----------

[SecurityBundle] fix accepting env vars in remember-me configurations

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

As @wouterj explained we cannot use env variables after #35910 merged.

> Hmm, so I'm guessing this is what happens:
>
> * `lifetime` is now an `integerNode()`
> * For the Config component (which IIRC doesn't know anything about env variables), you're passing a string: `"%env(int:REMEMBER_ME_COOKIE_LIFETIME)%"`
> * This throws an error, although if it wouldn't, the DI component would sucessfully process the string into a integer before it's used by any PHP class.
>
> So we either make Config aware of environment variables (that's probably a huge feature) or we revert the `integerNode()` changes (as you suggested).
>
> @HeahDude am I mislooking something, or would reverting these 2 lines not result in much harm? (only a little less strict config processor)

Commits
-------

46c278316c [SecurityBundle] fix accepting env vars in remember-me configurations
2020-04-18 14:12:43 +02:00
Talha Zekeriya Durmuş
46c278316c [SecurityBundle] fix accepting env vars in remember-me configurations 2020-04-18 14:12:03 +02:00
Nicolas Grekas
0f1a5c452e bug #36343 [Form] Fixed handling groups sequence validation (HeahDude)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Fixed handling groups sequence validation

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | FIx https://github.com/symfony/symfony/issues/9939#issuecomment-607459505, Fix #35556
| License       | MIT
| Doc PR        | ~

This is not the same as the original issue fixed by #36245, that was reported in https://github.com/symfony/symfony/issues/9939#issuecomment-607459505.

The form also fails to cascade sequence validation properly because each nested field is validated against the sequence, and one can fail at a step independently from another which could failed in another step. I've added a lot of tests to ensure this is working properly and tested in a website skeleton too.

This PR aims to close #35556 which tries to fix the same issue but afterwards in its implementation as said in https://github.com/symfony/symfony/pull/35556#discussion_r379289230.

Commits
-------

dfb61c204c [Form] Fixed handling groups sequence validation
2020-04-18 14:07:22 +02:00
Jules Pietri
dfb61c204c
[Form] Fixed handling groups sequence validation 2020-04-18 13:27:37 +02:00
Fabien Potencier
2460ca59af feature #36464 [RedisMessengerBridge] Add a delete_after_ack option (Seldaek)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[RedisMessengerBridge] Add a delete_after_ack option

This allows Messenger to clean up processed messages from memory, avoiding a mem "leak" in redis

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/33715
| License       | MIT
| Doc PR        | symfony/symfony-docs#... TODO - will pile it on to https://github.com/symfony/symfony-docs/pull/11869 as it kinda binds together and a bigger refactor of the docs here is much needed to avoid all these gotchas

Right now by default a redis transport for messenger will leak memory as all messages stay in redis forever. You can configure `stream_max_entries` to automatically trim to a max of X entries, but that means if you have big peaks in messages you might start losing messages which have not been processed.

This PR provides an alternative to that, by deleting message as they are processed. This is ideal as it avoids having to find the right number for `stream_max_entries` (do you want to risk losing data or use more memory than needed on average?). The only catch is that if you have multiple groups consuming the same stream, the first one processing a message will delete it, so other groups will not see it. For that reason `setup()` attempts to detect this and fails hard if it is misconfigured to prevent data loss.

Commits
-------

7c416a7173 [RedisMessengerBridge] Add a delete_after_ack option to automatically clean up processed messages from memory
2020-04-17 14:22:43 +02:00
Jordi Boggiano
7c416a7173
[RedisMessengerBridge] Add a delete_after_ack option to automatically clean up processed messages from memory 2020-04-17 08:23:45 +02:00
Fabien Potencier
67948a7ffb feature #36431 [Messenger] Add FIFO support to the SQS transport (cv65kr)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Messenger] Add FIFO support to the SQS transport

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

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html

Commits
-------

37601753f1 [Messenger] Add FIFO support to the SQS transport
2020-04-17 05:34:16 +02:00
cv65kr
37601753f1 [Messenger] Add FIFO support to the SQS transport 2020-04-17 05:34:10 +02:00
Fabien Potencier
a85545f3e9 feature #36455 [Cache] Added context to log messages (Nyholm)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Cache] Added context to log messages

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

In my application logs, I've got many entries like:

> Failed to save key "foobar" of type string.

I know it is related to the cache, But I dont know from what adapter. I use a chain of Array, Apcu and Redis. This PR adds some context to that log entry so I know which one of my cache adapter that fails.

Commits
-------

a4d9e0fc94 [Cache] Added context to log messages
2020-04-17 05:32:08 +02:00
Nyholm
a4d9e0fc94 [Cache] Added context to log messages 2020-04-17 05:31:59 +02:00
Fabien Potencier
6f81e03331 bug #36463 [Mime] Ensure proper line-ending for SMIME (sstok)
This PR was merged into the 5.0 branch.

Discussion
----------

[Mime] Ensure proper line-ending for SMIME

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

Commits
-------

5e3ccc2814 [Mime] Ensure proper line-ending for SMIME
2020-04-17 05:29:44 +02:00
Fabien Potencier
5369aff94f minor #36468 Use ExpectDeprecationTrait (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Use ExpectDeprecationTrait

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

Commits
-------

08febef500 Use ExpectDeprecationTrait
2020-04-17 05:15:37 +02:00
Fabien Potencier
17bbaa502a bug #36460 [Cache] Avoid memory leak in TraceableAdapter::reset() (lyrixx)
This PR was merged into the 3.4 branch.

Discussion
----------

[Cache] Avoid memory leak in TraceableAdapter::reset()

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

When we call `ServicesResetter::reset()`, we want to reset the
application to its initial states. We don't want a memory leak :p

Commits
-------

15a8610c0c [Cache] Avoid memory leak in TraceableAdapter::reset()
2020-04-17 05:10:57 +02:00
Thomas Calvet
08febef500 Use ExpectDeprecationTrait 2020-04-16 18:52:30 +02:00
Thomas Calvet
24150370c3 [DependencyInjection][ServiceSubscriber] Support late aliases 2020-04-16 18:36:56 +02:00
Fabien Potencier
4d8a4b6ede Merge branch '5.0'
* 5.0:
  Fix From/Sender handling in Emails
2020-04-16 17:13:28 +02:00
Fabien Potencier
3b4c41fd4b Merge branch '4.4' into 5.0
* 4.4:
  Fix From/Sender handling in Emails
2020-04-16 17:13:13 +02:00
Fabien Potencier
3aa7f0c5bf bug #36467 Mailer from sender fixes (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

Mailer from sender fixes

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| 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 #35818, Fix #35805, Fix #33753 | License       | MIT
| Doc PR        | n/a

Commits
-------

e885860edc Fix From/Sender handling in Emails
2020-04-16 17:12:45 +02:00
Fabien Potencier
e885860edc Fix From/Sender handling in Emails 2020-04-16 16:49:30 +02:00
Sebastiaan
5e3ccc2814
[Mime] Ensure proper line-ending for SMIME 2020-04-16 13:38:11 +02:00
Grégoire Pineau
15a8610c0c [Cache] Avoid memory leak in TraceableAdapter::reset() 2020-04-15 20:25:28 +02:00
Nicolas Grekas
6dc7d8b211 Merge branch '5.0'
* 5.0:
  [PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions
  [Messenger] Make sure redis transports are initialized correctly
  Remove return type for Twig function workflow_metadata()
  [DI] fix typo
2020-04-15 18:09:08 +02:00
Nicolas Grekas
4f8f3747d3 Merge branch '4.4' into 5.0
* 4.4:
  [PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions
  [Messenger] Make sure redis transports are initialized correctly
  Remove return type for Twig function workflow_metadata()
  [DI] fix typo
2020-04-15 17:59:10 +02:00
Nicolas Grekas
14a204636d bug #36408 [PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions (soyuka)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | na
| License       | MIT
| Doc PR        | na

expectExceptionMessageRegExp is deprecated coming phpunit 8.5.3  see https://github.com/sebastianbergmann/phpunit/issues/4133

Not sure if I need to add something else lmk.

Commits
-------

cfd5a29eaf [PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions
2020-04-15 17:56:18 +02:00
soyuka
cfd5a29eaf [PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions 2020-04-15 17:55:41 +02:00
Fabien Potencier
39a7ee1a61 bug #36447 Remove return type for Twig function workflow_metadata() (gisostallenberg)
This PR was merged into the 4.4 branch.

Discussion
----------

Remove return type for Twig function workflow_metadata()

Technically it is allowed to have metadata other than string, even data that does not cast to string, like an array.

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

The workflow metadata store can contain not only strings, but setting nested metadata results in an error when workflow_metadata() is used in Twig.
Also see #36391

Commits
-------

55664c5a17 Remove return type for Twig function workflow_metadata()
2020-04-15 11:12:33 +02:00
Nicolas Grekas
98eeeae3d1 [DI] add syntax to stack decorators 2020-04-14 18:54:23 +02:00
Robin Chalas
efb0dee407 bug #36449 [Messenger] Make sure redis transports are initialized correctly (Seldaek)
This PR was squashed before being merged into the 4.4 branch (closes #36449).

Discussion
----------

[Messenger] Make sure redis transports are initialized correctly

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

Took me a while to figure out why my messages were dispatched/handled twice.. Turns out I had two messenger transports using the same dsn and the parsing was broken so they ended up both polling from a `""` stream, which caused them to both handle the messages (I think).

Below my config, note the trailing slash in the dsn was the root cause of the issue, but I don't think it's that unreasonable.

```
.env:

MESSENGER_TRANSPORT_DSN=redis://localhost:6379/?dbindex=3

messenger.yml:

            async_urgent:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    group: async_urgent
                    stream: messages_urgent
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    group: async
                    stream: messages

```

Commits
-------

68b3b898d8 [Messenger] Make sure redis transports are initialized correctly
2020-04-14 13:53:10 +02:00
Jordi Boggiano
68b3b898d8 [Messenger] Make sure redis transports are initialized correctly 2020-04-14 13:52:59 +02:00
Giso Stallenberg
55664c5a17 Remove return type for Twig function workflow_metadata()
Technically it is allowed to have metadata other than string, even data that does not cast to string, like an array.
Also see https://github.com/symfony/symfony/issues/36391
2020-04-14 11:16:32 +02:00
Nicolas Grekas
b3333e552d [DI] fix typo 2020-04-14 10:30:58 +02:00
Fabien Potencier
b2f210f1f3 feature #34363 [HttpFoundation] Add InputBag (azjezz)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpFoundation] Add InputBag

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

When ppl read a request attribute, they never check if an array is returned
This means many apps just fail with a 500 when adding `[]` in the query string.
This PR turns them to 400 basically (with a deprecation for now)

Commits
-------

0a2ef70c04 [HttpFoundation] add InputBag
2020-04-13 22:42:08 +02:00
azjezz
0a2ef70c04 [HttpFoundation] add InputBag 2020-04-13 21:20:37 +01:00
Fabien Potencier
d5fd44db8b feature #36445 [WebProfilerBundle] Make a difference between queued and sent emails (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[WebProfilerBundle] Make a difference between queued and sent emails

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

The current profiler panel for Mailer is confusing when emails are sent synchronously.

Before:

![image](https://user-images.githubusercontent.com/47313/79122064-19867f80-7d97-11ea-9371-672f1b6f2998.png)

After:

![image](https://user-images.githubusercontent.com/47313/79121986-e8a64a80-7d96-11ea-8a41-b50f1d160f5f.png)

The new version makes a difference between queued and sent messages. The goes goes for the web debug toolbar.

I've also fixed an HTML markup issue and made the display more compact.

Commits
-------

0ee98a1679 [WebProfilerBundle] Make a difference between queued and sent emails
2020-04-13 15:11:45 +02:00
Fabien Potencier
0ee98a1679 [WebProfilerBundle] Make a difference between queued and sent emails 2020-04-13 14:53:23 +02:00
Fabien Potencier
0933f90fd5 feature #36424 [Mailer][Messenger] add return statement for MessageHandler (ottaviano)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Mailer][Messenger] add return statement for MessageHandler

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       |
| License       | MIT
| Doc PR        |

By returning the result of the transporter in `MessageHandler` we can get hold of `SentMessage` from `HandledStamp::getResult()`.
![image](https://user-images.githubusercontent.com/4582866/79046122-3bed9100-7c0f-11ea-878f-65a6eb610758.png)

Commits
-------

7854cb488e [Mailer][Messenger] add return statement for MessageHandler
2020-04-13 13:14:28 +02:00
Nicolas Grekas
4f0375dccd fix merge 2020-04-13 12:44:30 +02:00
Nicolas Grekas
e94506bee7 Merge branch '5.0'
* 5.0:
  [DI] fix loading defaults when using the PHP-DSL
  RepeatedType should always have inner types mapped
2020-04-13 12:14:44 +02:00