Commit Graph

47682 Commits

Author SHA1 Message Date
Nicolas Grekas
33e2735d14 Merge branch '5.0'
* 5.0:
  [Mailer] fix merge
2020-02-04 23:28:14 +01:00
Nicolas Grekas
7f28ff0cb8 Merge branch '4.4' into 5.0
* 4.4:
  [Mailer] fix merge
2020-02-04 23:28:08 +01:00
Nicolas Grekas
abeee5f018 [Mailer] fix merge 2020-02-04 23:28:01 +01:00
Nicolas Grekas
0db2b0a4bc Merge branch '5.0'
* 5.0:
  [Mailer] fix typos
  [Messenger] fix typo
  [DI] Unknown env prefix not regornized as such
  [DI] Fix support for multiple tags for locators and iterators
  [PhpUnitBridge] Fix some errors when using serialized deprecations
  Fix HTTP client config handling
2020-02-04 20:57:28 +01:00
Nicolas Grekas
74a42d102f Merge branch '4.4' into 5.0
* 4.4:
  [Mailer] fix typos
  [Messenger] fix typo
  [DI] Unknown env prefix not regornized as such
  [DI] Fix support for multiple tags for locators and iterators
  [PhpUnitBridge] Fix some errors when using serialized deprecations
  Fix HTTP client config handling
2020-02-04 20:55:45 +01:00
Nicolas Grekas
88b4579942 [Mailer] fix typos 2020-02-04 20:55:13 +01:00
Nicolas Grekas
5ae1384e8f [Messenger] fix typo 2020-02-04 20:51:39 +01:00
Nicolas Grekas
b1b64c1361 bug #33960 [DI] Unknown env prefix not recognized as such (ro0NL)
This PR was submitted for the 4.3 branch but it was merged into the 4.4 branch instead.

Discussion
----------

[DI] Unknown env prefix not recognized as such

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This is a failing test to illustrate the difference between real and fake env vars when using an unknown prefix, followed by the `default` prefix.

```
%env(unknown:default::REAL)%
// Unsupported env var prefix "unknown".

%env(unknown:default::FAKE)%
// null
```

For `default::FAKE` we get `null` at

38b9a27976/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php (L103)

which is then preserved at

38b9a27976/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php (L123)

need inspiration for a patch still :)

Commits
-------

550819a655 [DI] Unknown env prefix not regornized as such
2020-02-04 16:57:32 +01:00
Roland Franssen
550819a655 [DI] Unknown env prefix not regornized as such 2020-02-04 16:57:17 +01:00
Nicolas Grekas
a59ce75722 bug #35342 [DI] Fix support for multiple tags for locators and iterators (Alexandre Parent)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI] Fix support for multiple tags for locators and iterators

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34462, Fix #35326
| License       | MIT
| Doc PR        | none

Fix PriorityTaggedServiceTrait::findAndSortTaggedServices to work with multiple explicitely tagged services as would be expected by !tagged_locator. Also reorganize PriorityTaggedServiceTrait::findAndSortTaggedServices to be simpler and easier to understand.

Commits
-------

6fc91eb192 [DI] Fix support for multiple tags for locators and iterators
2020-02-04 16:46:39 +01:00
Alexandre Parent
6fc91eb192 [DI] Fix support for multiple tags for locators and iterators 2020-02-04 16:30:04 +01:00
Fabien Potencier
fc20461b10 feature #34278 Update bootstrap_4_layout.html.twig (CoalaJoe)
This PR was submitted for the 4.4 branch but it was squashed and merged into the 5.1-dev branch instead (closes #34278).

Discussion
----------

Update bootstrap_4_layout.html.twig

Add lang attribute to enable translating the "Browse" after text using SCSS variables.
Example:
```
$custom-file-text: (
        en: "Browse",
        de: "Auswählen"
);
```

https://github.com/twbs/bootstrap/blob/v4.3.1/scss/_variables.scss#L640

| Q             | A
| ------------- | ---
| Branch?       | 4.4 for features
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- 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/roadmap):
 - 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 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

b1b724f716 Update bootstrap_4_layout.html.twig
2020-02-04 15:31:24 +01:00
Ashura
b1b724f716 Update bootstrap_4_layout.html.twig 2020-02-04 15:31:16 +01:00
Nicolas Grekas
84d32aca73 bug #33820 [PhpUnitBridge] Fix some errors when using serialized deprecations (l-vo)
This PR was submitted for the 4.3 branch but it was squashed and merged into the 4.4 branch instead.

Discussion
----------

[PhpUnitBridge] Fix some errors when using serialized deprecations

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| 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
| License       | MIT
| Doc PR        | n/a

This PR attempts to fix conflicts that arose in #31478

Creating as a draft for now as I think having separate test methods no longer make sense (`isSelf()` and `isIndirect()` have been replaced with `getType()`). @l-vo please review and confirm I did not loose anything valuable from your original contribution.

Commits
-------

056d59824f [PhpUnitBridge] Fix some errors when using serialized deprecations
2020-02-04 15:16:59 +01:00
Laurent VOULLEMIER
056d59824f [PhpUnitBridge] Fix some errors when using serialized deprecations 2020-02-04 15:16:53 +01:00
Nicolas Grekas
71de43128f feature #31309 [SecurityBundle] add "service" option in remember_me firewall (Pchol)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[SecurityBundle] add "service" option in remember_me firewall

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

allow override remember me service

Commits
-------

bbf7421a92 [SecurityBundle] add "service" option in remember_me firewall
2020-02-04 15:06:32 +01:00
Pchol
bbf7421a92 [SecurityBundle] add "service" option in remember_me firewall 2020-02-04 15:05:46 +01:00
Nicolas Grekas
2aca43f908 feature #31429 [Messenger] add support for abstract handlers (timiTao)
This PR was submitted for the 4.4 branch but it was merged into the 5.1-dev branch instead.

Discussion
----------

[Messenger] add support for abstract handlers

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #31417    <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Added handling abstract handler.

Commits
-------

22e59f31be [Messenger] fix support for abstract handlers
2020-02-04 14:57:55 +01:00
TimiTao
22e59f31be [Messenger] fix support for abstract handlers 2020-02-04 14:57:29 +01:00
Fabien Potencier
a66b645681 feature #31466 [Validator] add Validation::createCallable() (janvernieuwe)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Validator] add Validation::createCallable()

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This is an initial PR to check/discuss the implementation of a callable validator.
If there is interest in merging this, I will gladly update the docs and such.

The use case is mainly for validation of console questions, since the default validation has been removed in the latest version and i could not find an easy solution to replace it (if there already is some solution for this, i'm not aware of it) and the question helper uses callables.
This small class allows the standard symfony validators to be used in console questions, or any other location that requires a callable validator.

Example use case:
```php
$io = new SymfonyStyle($input, $output);
$required = new CallableValidator([new NotBlank()]);
$wsdl = $io->ask('Wsdl location (URL or path to file)', null, $required);
```

As said before, this is by no means the final version, but I would like to know if there is interest  in merging this (and receive some feedback about the implementation) before I put any more effort into this.

Commits
-------

2e4f2ac322 [Validator] add Validation::createCallable()
2020-02-04 14:38:26 +01:00
Fabien Potencier
753d4a2639 feature #34747 [Notifier] Added possibility to extract path from provided DSN (espectrio)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Added possibility to extract path from provided DSN

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

I'm currently working on Microsoft Teams Webhook Notifier (https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook), and there is no way to provide DSN for it, because of missing parse_url()['path'] option

It looks like
`teams://outlook.office.com/webhook/{uuid}@{uuid}/IncomingWebhook/{id}/{uuid}`
and I'd like to be able to build Notifier Transport endpoint from it

Commits
-------

ab9b49b5c6 [Notifier] Added possibility to extract path from provided DSN
2020-02-04 14:19:51 +01:00
Fabien Potencier
626999c47f feature #35534 [FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase (adrienfr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase

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

Since 4.4, we have new PHPUnit constraints for the mailer component, but these are only available with `WebTestCase` and not `KernelTestCase`. I think this would be useful to access these constraints from both TestCase.

I don't know if I should move these [tests](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php) or add new ones only for `KernelTestCase`?

Commits
-------

1b1ab2991a [FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase
2020-02-04 14:16:01 +01:00
Fabien Potencier
7a4637eef9 feature #35590 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement

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

No need to configure the same requirements for `_locale` in all routes any more thanks to the `framework.translator.enabled_locales` config option introduced in #32433.

Commits
-------

5eebd37625 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement
2020-02-04 14:14:04 +01:00
Nicolas Grekas
5eebd37625 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement 2020-02-04 14:13:19 +01:00
Fabien Potencier
c8725bf198 feature #35167 [Notifier] Remove superfluous parameters in *Message::fromNotification() (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Remove superfluous parameters in *Message::fromNotification()

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

Those classes are final so I think we don't need those extra arguments.

Commits
-------

d0dacf51e1 [Notifier] Remove superfluous parameters in *Message::fromNotification()
2020-02-04 14:11:37 +01:00
Fabien Potencier
9b69b08062 feature #35415 Extracted code to expand an URI to UriExpander (lyrixx)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Extracted code to expand an URI to `UriExpander`

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

When building a crawler we need to extract and to expand all links on a
web pages.

ATM, we need to create a DomDocument, attach the href, and ask for the
full URL.

This is a bit slow, and unecessary. This is why I extracted the minimal
code to expand the URL to its onw trait for better re-usability.

I benched (a specific part of) my application:

 * before: 2.16ms
 * after: 1.42ms

Commits
-------

0c499c6b35 Extracted code to expand an URI to `UriExpanderTrait`
2020-02-04 14:05:04 +01:00
Grégoire Pineau
0c499c6b35 Extracted code to expand an URI to UriExpanderTrait 2020-02-04 14:03:49 +01:00
Jérémy Derussé
c226479d5f
[Messenger] Add SQS transport 2020-02-04 11:49:33 +01:00
Fabien Potencier
ef30ef55d0 Fix CS 2020-02-04 11:45:13 +01:00
Fabien Potencier
e3fa80a514 feature #35485 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY (dunglas)
This PR was squashed before being merged into the 5.1-dev branch (closes #35485).

Discussion
----------

[Messenger] Add support for PostgreSQL LISTEN/NOTIFY

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

PostgreSQL comes with a builtin, performant, scalable and transactional pub/sub system called [`LISTEN`/`NOTIFY`](https://www.postgresql.org/docs/current/sql-notify.html).
This PR allows to leverage this mechanism when using the Messenger component with Postgres.

When the Postgres is used, workers are notified in real-time when a message is dispatched.
This reduces the latency, and prevents the worker from executing useless SQL queries. Basically, it allows to switch from a polling-based approach to an event-based one.

This patch can be used with all existing installation of Messenger, as long as the underlying DBMS is Postgres. For many (most ?) projects, it allows to get the benefits of using a queue system such as RabbitMQ or Pulsar without having to introduce new services to monitor, replicate or upgrade.

If PostgreSQL is used, `LISTEN`/`NOTIFY` is used automatically!

That's all!

It's also possible to configure how long the worker must wait for new messages:

```yaml
framework:
    messenger:
        transports:
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    pgsql_get_notify: true
                    pgsql_get_notify_timeout: 500
```

Then you can use start the workers with something like: `php bin/console messenger:consume --sleep=0`

A demo app using this new feature is available in this repository: https://github.com/dunglas/demo-postgres-listen-notify

TODO:

* [ ] Add tests

Commits
-------

01f33c3ab5 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY
2020-02-04 11:44:36 +01:00
Kévin Dunglas
01f33c3ab5 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY 2020-02-04 11:42:42 +01:00
Fabien Potencier
3750988c42 bug #35553 Fix HTTP client config handling (julienfalque)
This PR was merged into the 4.4 branch.

Discussion
----------

Fix HTTP client config handling

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

Defining a `key` parameter in the `query` option of a scoped HTTP client triggers an error:
```
Undefined index: value
```
This PR fixes this issue but an edge case still remains with YAML and PHP config. If one wants to define parameters `key=foo`, `value=bar` and nothing else, the query will actually be `foo=bar` instead of `key=foo&value=bar`. Not sure how to fix this case without breaking the tests I added here.

Commits
-------

963d0cce86 Fix HTTP client config handling
2020-02-04 11:40:26 +01:00
Fabien Potencier
9613f84df5 minor #35589 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call (chalasr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Mailer] Fix MandrillHttpTransport::getRecipients()'s call

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

Should make the CI green.

Commits
-------

f88d1bb328 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call
2020-02-04 11:37:49 +01:00
Fabien Potencier
cf9f5a071c feature #32039 [Cache] Add couchbase cache adapter (ajcerezo)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Cache] Add couchbase cache adapter

| Q             | A
| ------------- | ---
| Branch?       | 4.4 for features
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/32038
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/11748

Add new cache adapter to be able using Couchbase as cache system.

Commits
-------

1ae7dd5ec7 [Cache] Add couchbase cache adapter
2020-02-04 11:36:41 +01:00
Antonio José Cerezo Aranda
1ae7dd5ec7 [Cache] Add couchbase cache adapter 2020-02-04 11:32:31 +01:00
Nicolas Grekas
1e2b88f43e Merge branch '5.0'
* 5.0:
  cs fix
  Escape variable in Exception Template
2020-02-04 11:31:29 +01:00
Nicolas Grekas
244c347178 Merge branch '4.4' into 5.0
* 4.4:
  Escape variable in Exception Template
2020-02-04 11:31:13 +01:00
Robin Chalas
f88d1bb328 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call 2020-02-04 11:29:55 +01:00
Fabien Potencier
eaec5d67ae bug #35588 [ErrorHandler] Escape variable in Exception template (jderusse)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Escape variable in Exception template

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

Commits
-------

629d21b800 Escape variable in Exception Template
2020-02-04 11:28:16 +01:00
Nicolas Grekas
6b18e7007a Merge branch '4.4' into 5.0
* 4.4:
  cs fix
2020-02-04 11:22:37 +01:00
Nicolas Grekas
f312e3cda6 Merge branch '3.4' into 4.4
* 3.4:
  cs fix
2020-02-04 11:21:54 +01:00
Fabien Potencier
f23aa969f4 feature #32433 [Translation] Introduce a way to configure the enabled locales (javiereguiluz)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Translation] Introduce a way to configure the enabled locales

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #31563
| License       | MIT
| Doc PR        | -

This implements the idea #31563 so we can decide if we want to add this or not. I tested it in the "Symfony Demo" app. Before: 107 catalogs created in cache/dev/translations/. After: 43 catalogs. But that's because the app is translated into lots of languages. In most cases, only 2 catalog files will be generated (vs 107 before).

If this idea is approved, I'll add tests and docs. Thanks.

Commits
-------

765843426e [Translation] Introduce a way to configure the enabled locales
2020-02-04 11:12:18 +01:00
Fabien Potencier
61774e6c07 Fix CS 2020-02-04 11:11:53 +01:00
Fabien Potencier
a416a66416 Fix bad merge 2020-02-04 11:11:20 +01:00
Fabien Potencier
a841a3e52c Fix CS 2020-02-04 11:10:55 +01:00
Fabien Potencier
2f5047ea3d Merge branch '5.0'
* 5.0:
  Fix bad merge
2020-02-04 11:03:49 +01:00
Fabien Potencier
a196d0571d Fix bad merge 2020-02-04 11:03:41 +01:00
Nicolas Grekas
c2e0aab7be cs fix 2020-02-04 10:59:34 +01:00
Javier Eguiluz
765843426e [Translation] Introduce a way to configure the enabled locales 2020-02-04 10:57:06 +01:00
Jérémy Derussé
629d21b800
Escape variable in Exception Template 2020-02-04 10:53:50 +01:00