Commit Graph

47760 Commits

Author SHA1 Message Date
Nicolas Grekas
29e5222498 Merge branch '4.4' into 5.0
* 4.4:
  [Bridge/PhpUnit] fix compat with recent versions of phpunit
2020-02-05 19:46:35 +01:00
Nicolas Grekas
cacb503294 [Bridge/PhpUnit] fix compat with recent versions of phpunit 2020-02-05 19:46:15 +01:00
Nicolas Grekas
32f2374426 Merge branch '5.0'
* 5.0:
  [Bridge/PhpUnit] fix parse error on PHP5
  Replace 403 with 401 in onAuthenticationFailure method
2020-02-05 19:24:38 +01:00
Nicolas Grekas
63bdce4847 Merge branch '4.4' into 5.0
* 4.4:
  [Bridge/PhpUnit] fix parse error on PHP5
  Replace 403 with 401 in onAuthenticationFailure method
2020-02-05 19:24:05 +01:00
Nicolas Grekas
c31ce63221 [Bridge/PhpUnit] fix parse error on PHP5 2020-02-05 19:23:47 +01:00
Fabien Potencier
829fc725c5 feature #35608 [Routing] add priority option to annotated routes (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Routing] add priority option to annotated routes

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

This PR allows defining the priority of routes using annotations:
`@Route(name="foo", priority=10)`

As requested [in this comment](https://github.com/symfony/symfony/pull/26132#pullrequestreview-352321332), priority is reserved to using annotations. For other formats, the order works fine.

Commits
-------

8522a83217 [Routing] add priority option to annotated routes
2020-02-05 19:16:11 +01:00
Fabien Potencier
8c596bce30 feature #35526 [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices

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

This PR results from a discussion we had yesterday with @alcaeus, @beberlei and others at the Symfony UG meetup in Berlin (thanks SensioLabs for bringing me there).

It provides a generic function and convention to trigger deprecation notices, which could be a better alternative to the `@trigger_error(..., E_USER_DEPRECATED)` calls that we use currently.

This proposed package would provide a single global function named `deprecated()`.
Its purpose is to trigger deprecations in a way that can be silenced on production environment
by using the `zend.assertions` ini setting and that can be caught during development to generate reports.

The function requires at least 3 arguments:
 - the name of the package that is triggering the deprecation
 - the version of the package that introduced the deprecation
 - the message of the deprecation
 - more arguments can be provided: they will be inserted in the message using `printf()` formatting

Example:
```php
deprecated('symfony/blockchain', 8.9, 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin');
```

This will generate the following message:
`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.`

Check #35550 to see how using this function could look like on Symfony itself.

Commits
-------

f0f41cbfc5 [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices
2020-02-05 19:14:04 +01:00
Nicolas Grekas
625ec1b7d7 Merge branch '3.4' into 4.4
* 3.4:
  Replace 403 with 401 in onAuthenticationFailure method
2020-02-05 19:11:18 +01:00
Nicolas Grekas
adacae6f54 minor #35606 [Security] Replace 403 with 401 in onAuthenticationFailure method (alanpoulain)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Replace 403 with 401 in `onAuthenticationFailure` method

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

This comment in `onAuthenticationFailure` was misleading since a 401 status code should probably be returned instead of a 403.

Commits
-------

73bc793be2 Replace 403 with 401 in onAuthenticationFailure method
2020-02-05 19:10:08 +01:00
Nicolas Grekas
f0f41cbfc5 [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices 2020-02-05 19:04:04 +01:00
Nicolas Grekas
8522a83217 [Routing] add priority option to annotated routes 2020-02-05 19:01:26 +01:00
Nicolas Grekas
86573147b3 feature #32747 [Form] Add "is empty callback" to form config (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Form] Add "is empty callback" to form config

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/31572 for 4.4+
| License       | MIT
| Doc PR        | -

This PR introduces a new feature that allow to resolve a bug.

Currently, the `isEmpty()` behavior of the `Form` class is the same whatever its configuration. That prevents us to specify a different behavior by form type.

But I think that some form types should have dedicated empty values. For example, the `CheckboxType` model data either resolves to `true` (checked) or `false` (unchecked). But `false` is not an empty value in the `Form::isEmpty()` method, so a `CheckboxType` form can never be empty. `false` should not be in that list because for other form types, it's perfectly fine that it's not considered as an empty value.

The problem is better seen in https://github.com/symfony/symfony/issues/31572 with a `ChoiceType` that is never considered as empty (when no radio button is checked).

Being able to specify the "is empty" behavior by form type would also allow users to define their own logic in their custom form types + probably define it ourselves in all our form types in order to get rid of the default common behavior.

Commits
-------

7bfc27e7cf [Form] Add "is empty callback" to form config
2020-02-05 17:32:36 +01:00
Alan Poulain
73bc793be2
Replace 403 with 401 in onAuthenticationFailure method 2020-02-05 17:32:02 +01:00
Fabien Potencier
3bcf8cbc2d feature #34884 [DI] Enable auto alias compiler pass by default (X-Coder264)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[DI] Enable auto alias compiler pass by default

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

I'm sending this PR to trigger a discussion as @nicolas-grekas suggested in #34194

I'm using this quite a lot in one of my applications and I don't see any reasons why it shouldn't be enabled by default.

Commits
-------

4fde51745b Enable auto alias compiler pass by default
2020-02-05 17:15:57 +01:00
Nicolas Grekas
33c294fc39 Merge branch '5.0'
* 5.0:
  [PhpUnitBridge] fix getting the vendor/ dir for tests
2020-02-05 13:07:47 +01:00
Nicolas Grekas
435018529c Merge branch '4.4' into 5.0
* 4.4:
  [PhpUnitBridge] fix getting the vendor/ dir for tests
2020-02-05 13:07:42 +01:00
Nicolas Grekas
e2dbff5af3 minor #35601 [PhpUnitBridge] fix getting the vendor/ dir for tests (nicolas-grekas)
This PR was submitted for the master branch but it was merged into the 4.4 branch instead.

Discussion
----------

[PhpUnitBridge] fix getting the vendor/ dir for tests

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

Commits
-------

341dd5dd1d [PhpUnitBridge] fix getting the vendor/ dir for tests
2020-02-05 13:07:26 +01:00
Nicolas Grekas
341dd5dd1d [PhpUnitBridge] fix getting the vendor/ dir for tests 2020-02-05 13:07:20 +01:00
Robin Chalas
0b8adc99a7 minor #35600 [Messenger] Made final class really final (lyrixx)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Messenger] Made final class really final

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

introduced in #35485 (so no BC break)

Commits
-------

cd8a386284 [Messenger] Made final class really final
2020-02-05 13:01:01 +01:00
Grégoire Pineau
cd8a386284 [Messenger] Made final class really final 2020-02-05 11:10:06 +01:00
Nicolas Grekas
115de5a756 Merge branch '5.0'
* 5.0:
  Provide current file as file path
2020-02-05 10:24:01 +01:00
Nicolas Grekas
b0cb757909 Merge branch '4.4' into 5.0
* 4.4:
  Provide current file as file path
2020-02-05 10:23:33 +01:00
Nicolas Grekas
b6acfae9dc bug #35597 [PHPunit bridge] Provide current file as file path (greg0ire)
This PR was merged into the 4.4 branch.

Discussion
----------

[PHPunit bridge] Provide current file as file path

I failed to apply perfectly this comment:
https://github.com/symfony/symfony/pull/33820#discussion_r338746158
It should fix one failing test in the bridge.

| Q             | A
| ------------- | ---
| Branch?       |4.4
| Bug fix?      | not for the end user
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a
<!--
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 master.
-->

Commits
-------

d5302cb5d2 Provide current file as file path
2020-02-05 10:22:36 +01:00
Grégoire Paris
d5302cb5d2 Provide current file as file path 2020-02-05 10:22:11 +01:00
Robin Chalas
2646fa9eb8 [Serializer] Added missing changelog entry 2020-02-05 10:18:48 +01:00
Robin Chalas
99ca1abd35 feature #35596 [Serializer] Add support for stdClass (dunglas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Serializer] Add support for stdClass

| 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 #33047, #33894
| License       | MIT
| Doc PR        | n/a

Add support for `stdClass`. Alternative to #33894.

Commits
-------

d7bca80007 [Serializer] Add support for stdClass
2020-02-05 10:15:58 +01:00
Toni Rudolf
9cb6fdfabb Implemted receiving of old pending messages 2020-02-05 09:54:08 +01:00
Kévin Dunglas
d7bca80007
[Serializer] Add support for stdClass 2020-02-05 01:28:27 +01:00
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