Commit Graph

44553 Commits

Author SHA1 Message Date
Nicolas Grekas
894a78e812 [Cache] dont override native Memcached options 2019-09-26 13:13:54 +02:00
Fabien Potencier
0222ea5df9 bug #33703 [Cache] fail gracefully when locking is not supported (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[Cache] fail gracefully when locking is not supported

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

Commits
-------

93485190f9 [Cache] fail gracefully when locking is not supported
2019-09-26 10:04:46 +02:00
Fabien Potencier
d52515ab1b Fix CS 2019-09-26 09:59:37 +02:00
Fabien Potencier
ebf9f8f71a bug #33713 Fix exceptions (PDOException) error code type (fruty)
This PR was squashed before being merged into the 4.3 branch (closes #33713).

Discussion
----------

Fix exceptions (PDOException) error code type

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #33704
| License       | MIT

From the [php.net docs](https://www.php.net/manual/en/exception.getcode.php) `Exception::getCode()` description:

> Returns the exception code as integer in Exception but possibly as other type in Exception descendants (for example as **string** in PDOException).

So if can be string, we convert it to the int in the `HandlerFailedException` but it still string in `nestedExceptiions`.

Commits
-------

9efa025a2a Fix exceptions (PDOException) error code type
2019-09-26 09:58:51 +02:00
fruty
9efa025a2a Fix exceptions (PDOException) error code type 2019-09-26 09:58:46 +02:00
Nicolas Grekas
b56a4b4f3a minor #33711 [ErrorHandler] fix return-type patching logic (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] fix return-type patching logic

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

My bad.

Commits
-------

302a921976 [ErrorHandler] fix return-type patching logic
2019-09-25 22:41:38 +02:00
Nicolas Grekas
302a921976 [ErrorHandler] fix return-type patching logic 2019-09-25 22:29:01 +02:00
Fabien Potencier
d04fdee000 bug #32335 [Form] Names for buttons should start with lowercase (mcfedr)
This PR was merged into the 4.3 branch.

Discussion
----------

[Form] Names for buttons should start with lowercase

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

This fix changes the messages related to the changes in https://github.com/symfony/symfony/pull/28969 - the message used to state that names should start with a letter, a digit ... - so I got a confusing message:

```
Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("Search" given).'
```

Which made me find the message, look at the regex that was used, and work out that actually it should start with a lowercase letter, and hence this PR - where I assume there is a reason that the name must start with lowercase letters.

Commits
-------

f65524e4e0 Names for buttons should start with lowercase
2019-09-25 21:19:30 +02:00
Fabien Potencier
b0c2112fb7 feature #33113 [Messenger][DX] Display real handler if handler is wrapped (DavidBadura)
This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger][DX] Display real handler if handler is wrapped

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

Execute:

```
bin/console debug:messenger
```

Before:

<img width="718" alt="Bildschirmfoto 2019-08-11 um 15 35 10" src="https://user-images.githubusercontent.com/470138/62834539-5faaa280-bc4e-11e9-99d6-a7e98822108c.png">

After:

<img width="673" alt="Bildschirmfoto 2019-08-11 um 15 34 27" src="https://user-images.githubusercontent.com/470138/62834540-646f5680-bc4e-11e9-9aa7-c5fb5219204c.png">

Commits
-------

e6ce9b560c display real handler if handler is wrapped
2019-09-25 21:12:09 +02:00
Fabien Potencier
098584a33c feature #33128 [FrameworkBundle] Sort tagged services (krome162504)
This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Sort tagged services

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

Hi

This PR it's to improve DX when `debug:container` command is use with tag argument by sorting them by priority (More details in linked issue).
Currently they are sort by alphabetical order.

Commits
-------

54cef2a3a3 [FrameworkBundle] Sort tagged service by priority
2019-09-25 21:10:01 +02:00
Fabien Potencier
db5cf1a83e bug #33350 [DI] scope singly-implemented interfaces detection by file (daniel-iwaniec, nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI] scope singly-implemented interfaces detection by file

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

[DependencyInjection] fixed handling singly implemented interfaces when importing multiple resources

for example:
```yaml
App\Adapter\:
    resource: '../src/Adapter/*'
App\Port\:
    resource: '../src/Port/*'
```

this configuration wont create service for interface (in other words singly implemented interface wont be autowired) and this chage fixes it

**Also** this will prevent false positives - for example if I had one implementation in \App\Port namespace and another in \App\Adapter then interface service would still be registered

but that could potentially break exisitng code not aware of this bug

Commits
-------

c1f39709ff [DI] add FileLoader::registerAliasesForSinglyImplementedInterfaces()
bec38900d8 [DI] scope singly-implemented interfaces detection by file
2019-09-25 21:03:45 +02:00
Fabien Potencier
4cf7ec1ecf feature #33658 [Yaml] fix parsing inline YAML spanning multiple lines (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Yaml] fix parsing inline YAML spanning multiple lines

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

Commits
-------

85a5c31e05 fix parsing inline YAML spanning multiple lines
2019-09-25 20:53:23 +02:00
Fabien Potencier
b1802085ec bug #33674 [ErrorHandler] Show fallback error page when default error controller is disabled (yceruto)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Show fallback error page when default error controller is disabled

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

This would avoid a blank page on errors when we've disabled the default error controller. e.g:
```yaml
framework:
    error_controller: null
```
So, we will show you the default HTML error page.

Commits
-------

8eea11cc26 Show fallback error page when framework.error_controller is null
2019-09-25 20:52:25 +02:00
Fabien Potencier
745248f329 minor #33708 [ErrorHandler] don't throw deprecations for return-types by default (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] don't throw deprecations for return-types by default

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

As discussed a few times already,  in 4.4, `DebugClassLoader` shouldn't trigger deprecations when return types are missing. We'll enable them back in 5.1.

Commits
-------

2cb419edf4 [ErrorHandler] don't throw deprecations for return-types by default
2019-09-25 20:45:24 +02:00
Fabien Potencier
89d7931fdf feature #33698 [HttpKernel] compress files generated by the profiler (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] compress files generated by the profiler

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

I've recently seen several reports of fastly growing profiler storages. Let's compress them when possible.

Locally for the skeleton homepage, a single profile goes from 150k to 15k. Level 3 is producing significant compression ratio while being measurably faster than level 6 (the default), that's why I'm using it.

Commits
-------

08f9470556 [HttpKernel] compress files generated by the profiler
2019-09-25 20:41:47 +02:00
Fabien Potencier
e2e73eff1d feature #33317 [Messenger] Added support for from_transport attribute on messenger.message_handler tag (ruudk)
This PR was squashed before being merged into the 4.4 branch (closes #33317).

Discussion
----------

[Messenger] Added support for `from_transport` attribute on `messenger.message_handler` tag

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #33306
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/12231

Right now, it's only possible to have dynamic `from_transport` when using `MessageSubscriberInterface`. Things like `priority` and `bus` can already be added as attributes on the  messenger.message_handler` tag.

With this PR it now also supports `from_transport`.

Commits
-------

c965e4e844 [Messenger] Added support for `from_transport` attribute on `messenger.message_handler` tag
2019-09-25 20:39:14 +02:00
Ruud Kamphuis
c965e4e844 [Messenger] Added support for from_transport attribute on messenger.message_handler tag 2019-09-25 20:39:09 +02:00
Nicolas Grekas
2cb419edf4 [ErrorHandler] don't throw deprecations for return-types by default 2019-09-25 19:39:21 +02:00
Fabien Potencier
a0bbae7514 Merge branch '4.3' into 4.4
* 4.3:
  ensure legacy event dispatcher compatibility
2019-09-25 17:04:11 +02:00
Fabien Potencier
5d4f302048 bug #33707 [Mailer] ensure legacy event dispatcher compatibility (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] ensure legacy event dispatcher compatibility

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

Commits
-------

860688ff2e ensure legacy event dispatcher compatibility
2019-09-25 16:56:38 +02:00
Fabien Potencier
9523035556 minor #33705 Fix return type of Process::restart() (derrabus)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix return type of Process::restart()

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

`Process::restart()` is annotated with `@return $this`, but it actually returns a clone of the current object. So `@return static` would be more appropriate.

Commits
-------

7d7380d9e7 Fix return type of Process::restart().
2019-09-25 16:56:02 +02:00
Fabien Potencier
29a54c5334 bug #33706 [Mailer][Messenger] ensure legacy event dispatcher compatibility (xabbuh)
This PR was merged into the 4.3 branch.

Discussion
----------

[Mailer][Messenger] ensure legacy event dispatcher compatibility

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

Commits
-------

4fcc1bc6fa ensure legacy event dispatcher compatibility
2019-09-25 16:55:19 +02:00
Nicolas Grekas
5cd1d7b4cc [Security] add "anonymous: lazy" mode to firewalls 2019-09-25 16:50:19 +02:00
Christian Flothmann
860688ff2e ensure legacy event dispatcher compatibility 2019-09-25 16:41:08 +02:00
Christian Flothmann
1595d307cf Merge branch '4.3' into 4.4
* 4.3:
  fix version in @deprecated annotation
  [Security] use LegacyEventDispatcherProxy
  Add missing row_attr option to FormType
2019-09-25 16:40:34 +02:00
Christian Flothmann
4fcc1bc6fa ensure legacy event dispatcher compatibility 2019-09-25 16:27:22 +02:00
Alexander M. Turek
7d7380d9e7 Fix return type of Process::restart(). 2019-09-25 16:09:38 +02:00
Nicolas Grekas
93485190f9 [Cache] fail gracefully when locking is not supported 2019-09-25 15:53:41 +02:00
Christian Flothmann
479d8ee2a3 bug #33688 Add missing row_attr option to FormType (mcsky)
This PR was merged into the 4.3 branch.

Discussion
----------

Add missing row_attr option to FormType

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix: #33682 - related issue #33573
| License       | MIT

The #33573 modified Symfony's form themes. But the [FormType](https://github.com/symfony/form/blob/master/Extension/Core/Type/FormType.php) don't allow the option `row_attr` so the OptionResolver throw an exception that the option is unknown.

This PR basically add the option and give it to the form view (like `label_attr` do)

Commits
-------

d711ea2b54 Add missing row_attr option to FormType
2019-09-25 12:11:53 +02:00
Christian Flothmann
042f5b5a9d bug #33692 [HttpClient] fix undefined index access (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix undefined index access

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

When the request fails.

Commits
-------

7fce184d25 [HttpClient] fix undefined index access
2019-09-25 12:04:37 +02:00
Christian Flothmann
51b7e030a8 minor #33696 [Security] tweak deprecation messages and changelog (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] tweak deprecation messages and changelog

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

Commits
-------

eceb0e595c tweak deprecation messages and changelog
2019-09-25 11:52:51 +02:00
Christian Flothmann
a53732f28d bug #33693 [Security] use LegacyEventDispatcherProxy (dmaicher)
This PR was merged into the 4.3 branch.

Discussion
----------

[Security] use LegacyEventDispatcherProxy

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

I ran into an issue on one of my apps that has its own event dispatcher class using the old dispatch method signature

```php
public function dispatch($eventName, Event $event = null)
```

This leads to

```
TypeError: Argument 2 passed to X\Tests\Base\TestEventDispatcher::dispatch() must be an instance of Symfony\Component\EventDispatcher\Event or null, string given, called in /var/www/x/symfony/vendor/symfony/security/Http/Firewall/ContextListener.php on line 230

/var/www/x/symfony/tests/Base/TestEventDispatcher.php:20
/var/www/x/symfony/vendor/symfony/security/Http/Firewall/ContextListener.php:230
/var/www/x/symfony/vendor/symfony/security/Http/Firewall/ContextListener.php:111
```

since the event here is dispatched using the new signature:

https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Security/Http/Firewall/ContextListener.php#L259

Commits
-------

7067e48165 [Security] use LegacyEventDispatcherProxy
2019-09-25 11:50:36 +02:00
Nicolas Grekas
08f9470556 [HttpKernel] compress files generated by the profiler 2019-09-25 10:55:08 +02:00
Christian Flothmann
eceb0e595c tweak deprecation messages and changelog 2019-09-25 10:01:37 +02:00
Christian Flothmann
e01614527f fix version in @deprecated annotation 2019-09-25 09:46:23 +02:00
Gabriel Ostrolucký
81c6df511d
Use VarCloner data instead of legacy array for query params 2019-09-24 23:50:47 +02:00
David Maicher
7067e48165 [Security] use LegacyEventDispatcherProxy 2019-09-24 20:49:43 +02:00
Nicolas Grekas
7fce184d25 [HttpClient] fix undefined index access 2019-09-24 20:17:30 +02:00
Nicolas Grekas
450c3c4998 [HttpClient] fix race condition when reading response with informational status 2019-09-24 20:09:31 +02:00
Nicolas Grekas
373469b53f Merge branch '4.3' into 4.4
* 4.3:
  [Routing] fix bad fix
2019-09-24 18:23:28 +02:00
Nicolas Grekas
3ab7d57659 Merge branch '3.4' into 4.3
* 3.4:
  [Routing] fix bad fix
2019-09-24 18:23:04 +02:00
Nicolas Grekas
04fe347df9 [Routing] fix bad fix 2019-09-24 18:22:08 +02:00
Nicolas Grekas
51a2cb6e3c Merge branch '4.3' into 4.4
* 4.3:
  [Security/Http] fix typo in deprecation message
  Various tweaks 3.4
  Various tweaks 4.3
  [PhpUnit] Fix usleep mock return value
  [Lock] use Predis\ClientInterface instead of Predis\Client
  Fix version typo in deprecation notice
  Make legacy "wrong" RFC2047 encoding apply only to one header
2019-09-24 17:57:39 +02:00
Nicolas Grekas
1ccc970469 minor #33690 [Security/Http] fix typo in deprecation message (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[Security/Http] fix typo in deprecation message

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

spotted by @stof in #33676

Commits
-------

e70057aed4 [Security/Http] fix typo in deprecation message
2019-09-24 17:54:42 +02:00
Nicolas Grekas
7031e83a8f Merge branch '3.4' into 4.3
* 3.4:
  Various tweaks 3.4
  [PhpUnit] Fix usleep mock return value
  [Lock] use Predis\ClientInterface instead of Predis\Client
2019-09-24 17:54:14 +02:00
Nicolas Grekas
e70057aed4 [Security/Http] fix typo in deprecation message 2019-09-24 17:43:44 +02:00
Kevin Grenier
d711ea2b54 Add missing row_attr option to FormType 2019-09-24 17:38:26 +02:00
Fabien Potencier
3c7172d81e feature #33584 [Security] Deprecate isGranted()/decide() on more than one attribute (wouterj)
This PR was squashed before being merged into the 4.4 branch (closes #33584).

Discussion
----------

[Security] Deprecate isGranted()/decide() on more than one attribute

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

While I expect it not be used much, it is currently possible to call `isGranted()` on more than one attribute:

```php
if ($this->authorizationChecker->isGranted(['ROLE_USER', 'ROLE_ADMIN'])) {
    // ...
}
```

Supporting this includes a couple of problems/questions:

- It is not clear whether this is `OR` or `AND`;
- In fact, this is left over to the voter to decide upon. So it can vary for each voter and writers of new voters need to consider this (otherwise, you get issues like https://github.com/LeaseWeb/LswSecureControllerBundle/issues/4 );
- It promotes to vote over roles instead of actions.

I think we can do better. In the past, we've created all tooling for this to be self-explaining and easier:

```php
// ExpressionLanguage component (also includes other functions, like `is_granted('EDIT')`)
if ($this->authorizationChecker->isGranted("has_role('ROLE_USER') or has_role('ROLE_ADMIN')")) {
    // ...
}

// calling it multiple times in PHP (may reduce performance)
if ($this->authorizationChecker->isGranted('ROLE_USER')
    || $this->authorizationChecker->isGranted('ROLE_ADMIN')
) {
    // ...
}

// or by using Role Hierarchy, if a user really wants to vote on roles
```

This PR deprecates passing more than one attribute to `isGranted()` and `decide()` to remove this confusing bit in Security usage.

Backwards compatiblity help
---

I need some help in how to approach changing the `VoterInterface::vote(TokenInterface $token, $subject, array $attributes)` method in a backwards compatible way. Removing `array` breaks all Voters, so does changing it to `string` and removed the parameter all together.

Commits
-------

c64b0beffb [Security] Deprecate isGranted()/decide() on more than one attribute
2019-09-24 17:21:06 +02:00
Wouter J
c64b0beffb [Security] Deprecate isGranted()/decide() on more than one attribute 2019-09-24 17:21:01 +02:00
Fabien Potencier
e84bd65e91 feature #33663 [Security] Make stateful firewalls turn responses private only when needed (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Make stateful firewalls turn responses private only when needed

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

Replaces #28089

By taking over session usage tracking and replacing it with token usage tracking, we can prevent responses that don't actually use the token from turning responses private without changing anything to the lifecycle of security listeners. This makes the behavior much more seamless, allowing to still log the user with the monolog processor, and display it in the profiler toolbar.

This works by using two separate token storage services:
- `security.token_storage` now tracks access to the token and increments the session usage tracker when needed. This is the service that is injected in userland.
- `security.untracked_token_storage` is a raw token storage that just stores the token and is disconnected from the session. This service is injected in places where reading the session doesn't impact the generated output in any way (as e.g. in Monolog processors, etc.)

Commits
-------

20df3a125c [Security] Make stateful firewalls turn responses private only when needed
2019-09-24 17:09:00 +02:00