Commit Graph

50818 Commits

Author SHA1 Message Date
Grégoire Pineau
aa7a444c86 [Workflow] Expose the Metadata Store in the DIC 2020-08-28 16:51:18 +02:00
Grégoire Pineau
3c943b94ed [Semaphore] Fixed some bugs 2020-08-28 16:01:04 +02:00
Thomas Calvet
564dce39f8 [HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response 2020-08-28 14:30:47 +02:00
Fabien Potencier
03d494ddde bug #37971 [PropertyInfo] Backport support for typed properties (PHP 7.4) (dunglas)
This PR was merged into the 4.4 branch.

Discussion
----------

[PropertyInfo] Backport support for typed properties (PHP 7.4)

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| 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. <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/13719 to be fixed

Backports #34557 as suggested.

One of my workmate hit this issue with the Serializer component and it was not obvious for him why it was not working, without hint.

Commits
-------

1b19f255a3 [PropertyInfo] Backport support for typed properties (PHP 7.4)
2020-08-28 12:27:56 +02:00
Fabien Potencier
ac96fdacd3 minor #37974 [PhpUnitBridge] Create a predictable symlink pointing to the local install (dunglas)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Create a predictable symlink pointing to the local install

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| 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        | n/a

Static analysis tools such as PHPStan need to be able to autoload classes provided by to work. It's also useful to use the assertions provided by PHPUnit with other testing tools such as Behat.
When using `simple-phpunit`, PHPUnit isn't installed in the `vendor/` directory, consequently other tools cannot autoload its classes.

A workaround is to configure these tools to load the autoloader installed by `simple-phpunit`. Example with PHPstan:

```neon
parameters:
	bootstrapFiles:
		- vendor/bin/.phpunit/phpunit-9.2-0/vendor/autoload.php
```

However, the path of the autoloader isn't predictable: it depends of PHPUnit version.

This PR changes `simple-phpunit` to create a symlink with a predictable path (`vendor/.phpunit/phpunit`) pointing to the currently used version of PHPUnit, so it is possible to hardcode this value in config files.

The symlink is recreated before every run, so if a different version of PHPUnit must be used because the PHP version in use is different from the previous run (frequent when developing libraries compatible with multiple PHP versions), it still works.

Commits
-------

bf7654f245 [PhpUnitBridge] Create a predictable symlink pointing to the local install
2020-08-28 12:27:13 +02:00
Kévin Dunglas
bf7654f245 [PhpUnitBridge] Create a predictable symlink pointing to the local install 2020-08-28 12:27:07 +02:00
Fabien Potencier
2c4e215ee9 minor #37973 [Security] Also mark the authenticator security system experimental in 5.2 (wouterj)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Security] Also mark the authenticator security system experimental in 5.2

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

Commits
-------

176aef63d9 Also mark the authenticator security system experimental in 5.2
2020-08-28 10:48:36 +02:00
Wouter de Jong
176aef63d9 Also mark the authenticator security system experimental in 5.2 2020-08-28 10:27:42 +02:00
Kévin Dunglas
1b19f255a3 [PropertyInfo] Backport support for typed properties (PHP 7.4) 2020-08-28 10:21:30 +02:00
Fabien Potencier
f4115e7717 bug #37970 [PhpUnitBridge] Polyfill new phpunit 9.1 assertions (phpfour)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Polyfill new phpunit 9.1 assertions

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

Backport of #37567, follows the discussion on #37960.

Commits
-------

d945b88c1a [PhpUnitBridge] Polyfill new phpunit 9.1 assertions
2020-08-28 09:51:20 +02:00
Mohammad Emran Hasan
d945b88c1a [PhpUnitBridge] Polyfill new phpunit 9.1 assertions 2020-08-28 09:39:33 +02:00
Thomas Calvet
e2fce0d89f [FrameworkBundle] Do not pass the base uri twice to scoped http clients 2020-08-27 18:01:08 +02:00
Fabien Potencier
ba98fd74d6 feature #37432 [Mailer] Implement additional mailer transport options (fritzmg)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Mailer] Implement additional mailer transport options

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #37300
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/13911

This implements additional transport configuration options mentioned in #37300. It also adds a `command` option to be able to define the command used by the `sendmail` transport.

Examples:

```yml
framework:
  mailer:
    transports:
      sendmail: sendmail://default?command=/usr/sbin/sendmail%%20-oi%%20-t
      local_domain: smtps://smtp.example.com?local_domain=example.org
      restart_threshold: smtps://smtp.example.com?restart_threshold=10&restart_threshold_sleep=1
      ping_threshold: smtps://smtp.example.com?ping_threshold=200
```

Commits
-------

665d1cd3fa [Mailer] Implement additional mailer transport options
2020-08-27 16:56:03 +02:00
Fritz Michael Gschwantner
665d1cd3fa [Mailer] Implement additional mailer transport options 2020-08-27 16:55:56 +02:00
Fabien Potencier
df84e2263b minor #37965 Update Notifier bridge DSN in readme (jeremyFreeAgent)
This PR was merged into the 5.2-dev branch.

Discussion
----------

Update Notifier bridge DSN in readme

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

Add missing DSN documentation in README for 5.2

Commits
-------

eedd72cd98 Update Notifier bridge DSN in readme
2020-08-27 16:51:53 +02:00
Fabien Potencier
831966981b minor #37964 [PhpUnitBridge] Move assertMatchesRegularExpression in PolyfillAssertTrait (dunglas)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Move assertMatchesRegularExpression in PolyfillAssertTrait

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a

Move the polyfill method introduced in #37960 in the `Assert` trait. Sorry I noticed this trait later.

Commits
-------

0426113eda [PhpUnitBridge] Move assertMatchesRegularExpression in PolyfillAssertTrait
2020-08-27 16:50:42 +02:00
Fabien Potencier
40022972f6 bug #37578 [HttpClient] fix pausing AmpResponse (kelunik)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] fix pausing AmpResponse

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

This fixes the pause handler while streaming bodies in `AmpHttpClient`.

Needs to be rebased onto the target branch and needs some test fixes. @nicolas-grekas FYI.

Commits
-------

bf2d1cf6e7 Improve pause handler
2020-08-27 16:48:24 +02:00
Jérémy Romey
eedd72cd98
Update Notifier bridge DSN in readme 2020-08-27 16:44:35 +02:00
Fabien Potencier
fe4d92806b feature #35893 [HttpClient][DI] Add an option to use the MockClient in functional tests (GaryPEGEOT)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[HttpClient][DI] Add an option to use the MockClient in functional tests

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

Let's say you want to mock HTTP responses in your test or dev environment:

First, you create an invokable class responsible of generating the response:
```php
namespace App\Tests;

use Symfony\Contracts\HttpClient\ResponseInterface;

class MyAwesomeCallback
{
    public function __invoke(string $method, string $url, array $options = []): ResponseInterface
    {
        // load a fixture file or generate dynamic data
    }
}
```

Then configure it:
```yaml

# config/services_test.yaml
services:
   # ...
   App\Tests\MyAwesomeCallback: ~

# config/packages/test/framework.yaml
framework:
    http_client:
        mock_response_factory: App\Tests\MyAwesomeCallback
```

The HttpClient will now be using MockHttpClient in your functional test:
```php
$client = static::createClient();

// No live HTTP connection made
$client->request('GET', '/path-with-http-call');
```

Commits
-------

b53739c79d [HttpClient][DI] Add an option to use the MockClient in functional tests
2020-08-27 16:44:19 +02:00
Gary PEGEOT
b53739c79d [HttpClient][DI] Add an option to use the MockClient in functional tests 2020-08-27 16:44:13 +02:00
Kévin Dunglas
0426113eda
[PhpUnitBridge] Move assertMatchesRegularExpression in PolyfillAssertTrait 2020-08-27 16:43:53 +02:00
Fabien Potencier
ce8b497824 feature #35780 [Semaphore] Added the component (lyrixx)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Semaphore] Added the component

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

---

[Semaphore] Added the component

Few years ago, we have introduced the Lock component. This is a very nice component, but sometime it is not enough. Sometime you need semaphore.

This is why I'm introducing this new component.

## What is a Semaphore ?

From wikipedia:

> In computer science, a semaphore is a variable or abstract data type used to control access to a common resource by multiple processes in a concurrent system such as a multitasking operating system. A semaphore is simply a variable. This variable is used to solve critical section problems and to achieve process synchronization in the multi processing environment. A trivial semaphore is a plain variable that is changed (for example, incremented or decremented, or toggled) depending on programmer-defined conditions.

This new component is more than a variable. This is an abstraction on top of different storage.

To make a quick comparison with a lock:

 * A lock allows only 1 process to access a resource;
 * A semaphore allow N process to access a resource.

Basically, a lock is a semaphore where `N = 1`.

### Possible confusion

PHP exposes some `sem_*` functions like [`sem_acquire`](http://php.net/sem_acquire). This module provides wrappers for the System V IPC family of functions. It includes semaphores, shared memory and inter-process messaging (IPC).

The Lock component has a storage that works with theses functions. It uses it with `N = 1`.

## What are the use-cases ?

Wikipedia has some [examples](https://en.wikipedia.org/wiki/Semaphore_(programming)#Examples)

But I can add one more commun use case.

If you are building an async system that process user data, you may want to priorise all jobs. You can achieve that by running at maximum N jobs per user at the same time. If the user has more resources, you give him more concurrent jobs (so a bigger `N`).

Thanks to semaphores, it's pretty easy to know if a new job can be run.

### Some concrete use-cases

I'm not saying the following services are using semaphore, but they may solve the previous problematic with semaphores. Here is some examples:

 * services like testing platform where a user can test N projects concurrently (travis, circle, appveyor, insight, ...)
 * services that ingest lots of data (newrelic, datadog, blackfire, segment.io, ...))
 * services that send email in batch (campaign monitor, mailchimp, ...)
 * etc...

## How to use it ?

To do so, since PHP is mono-threaded, you run M PHP workers. And in each worker, you look for for the next job. When you grab a job, you try to acquires a semaphore. If you got it, you process the job. If not you try another job.

FTR in other language, like Go, there are no need to run M workers, one is enough.

### With Symfony

```php
<?php

use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\Store\RedisStore as LockRedisStore;
use Symfony\Component\Semaphore\SemaphoreFactory;
use Symfony\Component\Semaphore\Store\RedisStore;

require __DIR__.'/vendor/autoload.php';

$redis = new Redis();
$redis->connect('172.17.0.2');

// Internally, Semaphore needs a lock
$lock = (new LockFactory(new LockRedisStore($redis)))->createLock('test:lock', 1);

// Create a semaphore:
// * name = test
// * limit = 3 (it means only 3 process are allowed)
// * ttl = 10 seconds : Maximum expected semaphore duration in seconds
$semaphore = (new SemaphoreFactory($lock, new RedisStore($redis)))->createSemaphore('test', 3, 10);

if (!$semaphore->acquire()) {
    echo "Could not acquire the semaphore\n";
    exit(1);
}

// The semaphore has been acquired

// Do the heavy job
for ($i = 0; $i < 100; ++$i) {
    sleep(1);
    // Before the expiration, refresh the semaphore if the job is not finished yet
    if ($i % 9 === 0) {
        $semaphore->refresh();
    }
}

// Release it when finished
$semaphore->release();
```

## Prior art

I looked at [packagist](https://packagist.org/?query=semaphore) and:

 * most of packages are using a semaphore storage for creating a lock. So there are not relevant here;
 * some packages need an async framework to be used (amphp for example);
 * the only packages really implementing a semaphore, has a really low code quality and some bugs.

## Current implementation

1. I initially copied the Lock component since the external API is quite similar;
1. I simplified it a lot for the current use case;
1. I implemented the RedisStorage according the [redis book](https://redislabs.com/ebook/part-2-core-concepts/chapter-6-application-components-in-redis/6-3-counting-semaphores/;)
1. I forced a TTL on the storage.

---

TODO:

 * [ ] documentation
 * [x] test
 * [x] ~~move the lock requirements to the redis storage only ?~~ Not needed anymore

Commits
-------

891285475e [Semaphore] Added the component
2020-08-27 16:33:10 +02:00
Fabien Potencier
2248639fb3 feature #37846 [Security] Lazily load the user during the check passport event (wouterj)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Security] Lazily load the user during the check passport event

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

**Before**
```php
class ApiKeyAuthenticator extends AbstractAuthenticator
{
    // ...

    public function authenticate(Request $request): PassportInterface
    {
        $email = $request->headers->get('X-USER-EMAIL');
        if (false === strpos($email, '@')) {
            throw new BadCredentialsException('Email is not a valid email address.');
        }

        $user = $this->userRepository->findOneBy(['email' => $email]);
        if (null === $user) {
            throw new UsernameNotFoundException();
        }

        return new SelfValidatingPassport($user);
    }
}
```

**After**
```php
class ApiKeyAuthenticator extends AbstractAuthenticator
{
    // ...

    public function authenticate(Request $request): PassportInterface
    {
        $email = $request->headers->get('X-USER-EMAIL');
        if (false === strpos($email, '@')) {
            throw new BadCredentialsException('Email is not a valid email address.');
        }

        // a global ChainUserProvider (or firewall provider if explicitly configured) will be
        // used to load the User with $email as username
        return new SelfValidatingPassport($email);

        // or a custom closure to load the user
        return new SelfValidatingPassport(new UserBadge($email, function ($username) {
            return $this->userRepository->findOneBy(['email' => $username]);
        });
    }
}
```

Doing it this way has a couple advantages (some of which are already mentioned in the issue):

* Some listeners on `CheckPassportEvent` need to execute *before* loading the user - to reduce resources (e.g. CSRF protection, if CSRF fails, no DB call should be made to load user - and also login throttling);
* Some listeners require knowing the username of the login action (e.g. login throttling on IP and username);
* The `UserProviderListener` allows to remove yet another centralized action in the authentication process from the authenticator class to the Symfony framework.

Automatic User Provider integration
---

Instead of passing the credentials and a closure to `UserBadge`, you can also just pass a (string) username. The user provider will then be used to load the user. This only works for `custom_authenticators` as of this moment.

* By default, a chain user provider with all configured `user_providers` will be used as the user provider;
* However, if you explicitly configure a `provider` for that firewall, that provider will be used (using a listener with higher priority).

Commits
-------

907ef311bf Lazily load the user during the check passport event
2020-08-27 16:29:00 +02:00
Wouter de Jong
907ef311bf Lazily load the user during the check passport event 2020-08-27 16:28:46 +02:00
Fabien Potencier
53a8f7d490 Fix tests 2020-08-27 16:13:35 +02:00
Fabien Potencier
d24f040389 feature #37934 [Mailer] Mailjet Add ability to pass custom headers to API (tcheymol)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Mailer] Mailjet Add ability to pass custom headers to API

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

Mailjet mailer now forwards headers from original email removes forbidden headers, and sends them to Maijlet Api

Additionally (see https://symfony.com/releases):
 - 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
-------

7b14ef3678 [Mailer] Mailjet Add ability to pass custom headers to API
2020-08-27 16:08:10 +02:00
Thibaut Cheymol
7b14ef3678 [Mailer] Mailjet Add ability to pass custom headers to API 2020-08-27 16:08:03 +02:00
Fabien Potencier
7da56f31ba bug #37960 [PhpUnit] Add polyfill for assertMatchesRegularExpression() (dunglas)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[PhpUnit] Add polyfill for assertMatchesRegularExpression()

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

`assertRegExp()` is now deprecated in favor of `assertMatchesRegularExpression`.

Commits
-------

33eccd2a00 [PhpUnit] Add polyfill for assertMatchesRegularExpression()
2020-08-27 16:03:12 +02:00
Kévin Dunglas
33eccd2a00 [PhpUnit] Add polyfill for assertMatchesRegularExpression() 2020-08-27 16:03:04 +02:00
Fabien Potencier
4d0ebc6b04 minor #37962 Update Notifier bridge DSN in readme (jeremyFreeAgent)
This PR was merged into the 5.1 branch.

Discussion
----------

Update Notifier bridge DSN in readme

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

Add missing DSN documentation in README for 5.1

Commits
-------

17c0784c44 Update Notifier bridge readme
2020-08-27 15:16:49 +02:00
Jérémy Romey
17c0784c44
Update Notifier bridge readme 2020-08-27 14:59:47 +02:00
Grégoire Pineau
891285475e [Semaphore] Added the component
Few years ago, we have introduced the Lock component. This is a very nice component, but sometime it is not enough. Sometime you need semaphore.

This is why I'm introducing this new component.

From wikipedia:

> In computer science, a semaphore is a variable or abstract data type used to control access to a common resource by multiple processes in a concurrent system such as a multitasking operating system. A semaphore is simply a variable. This variable is used to solve critical section problems and to achieve process synchronization in the multi processing environment. A trivial semaphore is a plain variable that is changed (for example, incremented or decremented, or toggled) depending on programmer-defined conditions.

This new component is more than a variable. This is an abstraction on top of different storage.

To make a quick comparison with a lock:

 * A lock allows only 1 process to access a resource;
 * A semaphore allow N process to access a resource.

Basically, a lock is a semaphore where `N = 1`.

PHP exposes some `sem_*` functions like [`sem_acquire`](http://php.net/sem_acquire). This module provides wrappers for the System V IPC family of functions. It includes semaphores, shared memory and inter-process messaging (IPC).

The Lock component has a storage that works with theses functions. It uses it with `N = 1`.

Wikipedia has some [examples](https://en.wikipedia.org/wiki/Semaphore_(programming)#Examples)

But I can add one more commun use case.

If you are building an async system that process user data, you may want to priorise all jobs. You can achieve that by running at maximum N jobs per user at the same time. If the user has more resources, you give him more concurrent jobs (so a bigger `N`).

Thanks to semaphores, it's pretty easy to know if a new job can be run.

I'm not saying the following services are using semaphore, but they may solve the previous problematic with semaphores. Here is some examples:

 * services like testing platform where a user can test N projects concurrently (travis, circle, appveyor, insight, ...)
 * services that ingest lots of data (newrelic, datadog, blackfire, segment.io, ...))
 * services that send email in batch (campaign monitor, mailchimp, ...)
 * etc...

To do so, since PHP is mono-threaded, you run M PHP workers. And in each worker, you look for for the next job. When you grab a job, you try to acquires a semaphore. If you got it, you process the job. If not you try another job.

FTR in other language, like Go, there are no need to run M workers, one is enough.

```php
<?php

use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\Store\RedisStore as LockRedisStore;
use Symfony\Component\Semaphore\SemaphoreFactory;
use Symfony\Component\Semaphore\Store\RedisStore;

require __DIR__.'/vendor/autoload.php';

$redis = new Redis();
$redis->connect('172.17.0.2');

// Internally, Semaphore needs a lock
$lock = (new LockFactory(new LockRedisStore($redis)))->createLock('test:lock', 1);

// Create a semaphore:
// * name = test
// * limit = 3 (it means only 3 process are allowed)
// * ttl = 10 seconds : Maximum expected semaphore duration in seconds
$semaphore = (new SemaphoreFactory($lock, new RedisStore($redis)))->createSemaphore('test', 3, 10);

if (!$semaphore->acquire()) {
    echo "Could not acquire the semaphore\n";
    exit(1);
}

// The semaphore has been acquired

// Do the heavy job
for ($i = 0; $i < 100; ++$i) {
    sleep(1);
    // Before the expiration, refresh the semaphore if the job is not finished yet
    if ($i % 9 === 0) {
        $semaphore->refresh();
    }
}

// Release it when finished
$semaphore->release();
```

I looked at [packagist](https://packagist.org/?query=semaphore) and:

 * most of packages are using a semaphore storage for creating a lock. So there are not relevant here;
 * some packages need an async framework to be used (amphp for example);
 * the only packages really implementing a semaphore, has a really low code quality and some bugs.

1. I initially copied the Lock component since the external API is quite similar;
1. I simplified it a lot for the current use case;
1. I implemented the RedisStorage according the [redis book](https://redislabs.com/ebook/part-2-core-concepts/chapter-6-application-components-in-redis/6-3-counting-semaphores/;)
1. I forced a TTL on the storage.
2020-08-27 14:35:29 +02:00
Fabien Potencier
6d521d4072 feature #37942 [Security] Renamed provider key to firewall name (wouterj)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Security] Renamed provider key to firewall name

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

This fixes the `$providerKey` argument names on the classes that will remain in use, even when the new Security system will take over. @fabpot do you think these changes are worth it?

Officially, all token classes are not marked as `@final`. Do I need to take into account when someone is overriding the `getProviderKey()` method? Also, I couldn't find a way to trigger a deprecation notice for deprecated properties, is this a problem?

Commits
-------

91b276326d Renamed $providerKey to $firewallName
2020-08-26 17:45:58 +02:00
Wouter de Jong
91b276326d Renamed $providerKey to $firewallName 2020-08-26 17:34:05 +02:00
Nicolas Grekas
9c86cd2b4e bug #37941 [TwigBridge] allow null for $message of filter method trans (Flinsch)
This PR was merged into the 5.1 branch.

Discussion
----------

[TwigBridge] allow null for $message of filter method `trans`

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

With Symfony 5.0, filter method `trans` of Symfony Twig Bridge does not allow null values for `$message` parameter anymore, breaking backward compatibility. See also #37931. The included commit provides a fix to this BC break by allowing null values again.

Commits
-------

039fc80d6c [TwigBridge] Fix #37931: BC break where filter method `trans` did not allow null values for `$message` parameter anymore
2020-08-26 16:33:20 +02:00
Flinsch
039fc80d6c [TwigBridge] Fix #37931: BC break where filter method trans did not allow null values for $message parameter anymore 2020-08-26 16:33:04 +02:00
Fabien Potencier
92cb709222 bug #37622 [PropertyAccess] Fix accessing dynamic properties (andreyserdjuk)
This PR was submitted for the master branch but it was squashed and merged into the 5.1 branch instead.

Discussion
----------

[PropertyAccess] Fix accessing dynamic properties

| Q             | A
| ------------- | ---
| Branch?       | 5.1 (to be switched when merging)
| 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 #37026 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | no <!-- 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/releases):
 - 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
-------

47bd0180d1 [PropertyAccess] Fix accessing dynamic properties
2020-08-26 15:25:49 +02:00
Andrii Serdiuk
47bd0180d1 [PropertyAccess] Fix accessing dynamic properties 2020-08-26 15:25:42 +02:00
Fabien Potencier
c642b8fb71 Merge branch '5.1'
* 5.1:
  [HttpClient] fix chaining promises returned by HttplugClient
  [DI] fix dumping lazy non-shared services
2020-08-26 13:35:34 +02:00
Fabien Potencier
fc3095ff2f bug #37927 [HttpClient] fix chaining promises returned by HttplugClient (CthulhuDen)
This PR was merged into the 5.1 branch.

Discussion
----------

[HttpClient] fix chaining promises returned by HttplugClient

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

Guzzle runtime does not play too well with foreign promises, which can be fixed by wrapping them with `promise_for`.
Added failing test case from #37925 and suggested fix.
Should not break BC because `then` callback results get resolved before being passed to next `then` callback or returned from `wait`.

Commits
-------

75043a1fb0 [HttpClient] fix chaining promises returned by HttplugClient
2020-08-26 13:34:52 +02:00
cthulhu
75043a1fb0 [HttpClient] fix chaining promises returned by HttplugClient 2020-08-26 12:50:35 +02:00
Niklas Keller
bf2d1cf6e7 Improve pause handler 2020-08-26 12:30:57 +02:00
Fabien Potencier
885390fbaf bug #37953 [DI] fix dumping lazy non-shared services (nicolas-grekas)
This PR was merged into the 5.1 branch.

Discussion
----------

[DI] fix dumping lazy non-shared services

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

Commits
-------

a4f4ca74a7 [DI] fix dumping lazy non-shared services
2020-08-26 11:10:33 +02:00
Nicolas Grekas
a4f4ca74a7 [DI] fix dumping lazy non-shared services 2020-08-26 10:54:37 +02:00
Fabien Potencier
27bb2828e3 Merge branch '5.1'
* 5.1:
  Backport: Improve link script with rollback when using symlink
  fix more numeric cases changing in PHP 8
  Fixed autoLogin() returning null
  [Notifier] add doc for free mobile dsn
2020-08-26 10:31:06 +02:00
Fabien Potencier
216f2fa94e Merge branch '4.4' into 5.1
* 4.4:
  Backport: Improve link script with rollback when using symlink
  fix more numeric cases changing in PHP 8
2020-08-26 10:30:57 +02:00
Fabien Potencier
6d850e04be Merge branch '3.4' into 4.4
* 3.4:
  Backport: Improve link script with rollback when using symlink
  fix more numeric cases changing in PHP 8
2020-08-26 10:30:46 +02:00
Fabien Potencier
a430ccbcf1 minor #37952 Backport: Improve link script with rollback when using symlink (noniagriconomie)
This PR was merged into the 3.4 branch.

Discussion
----------

Backport: Improve link script with rollback when using symlink

| Q             | A
| ------------- | ---
| Branch?       | 3.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | N/A <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | N/A

Backports #37915 to 3.4.

Even if it's a new feature, it's a contributors tool that can be used for any version to try out.

Commits
-------

ab92e9f4c3 Backport: Improve link script with rollback when using symlink
2020-08-26 10:30:29 +02:00
noniagriconomie
ab92e9f4c3 Backport: Improve link script with rollback when using symlink 2020-08-26 10:20:55 +02:00
Fabien Potencier
160b5982cf feature #37951 [FrameworkBundle] Make AbstractPhpFileCacheWarmer public (ossinkine)
This PR was submitted for the 3.4 branch but it was merged into the 5.2-dev branch instead.

Discussion
----------

[FrameworkBundle] Make AbstractPhpFileCacheWarmer public

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

Introducing the PhpArrayAdapter was a great feature. It has proven itself well in the production.
Actually, using the adapter is closely related to warming up the cache for it. FrameworkBundle has an AbstractPhpFileCacheWarmer for conveniently creating a custom warmer.
But using it outside of the FrameworkBundle becomes more complicated because it is marked as internal.
I propose making it public and allow it to be used outside of the FrameworkBundle.

For example, I've proposed to cache Doctrine metadata using PhpArrayAdapter and the implementation uses AbstractPhpFileCacheWarmer https://github.com/doctrine/DoctrineBundle/pull/1196

Commits
-------

a0fb44238e Make AbstractPhpFileCacheWarmer public
2020-08-26 09:58:08 +02:00