This PR was merged into the 5.2-dev branch.
Discussion
----------
Make RetryTillSaveStore implements the SharedLockStoreInterface
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | /
| License | MIT
| Doc PR | /
The `RetryTillSaveStore` decorates a non blocking store (ie. `RedisStore`) to make it blockable.
The issue is: if the decorate store manage SharedLock, the Decorator does not implements this interface. It's currently not possible to get both `blocking` and `sharable` store.
Commits
-------
a0321e66c9 Make RetryTillSaveStore implements the SharedLockStoreInterface
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Form] Add new way of mapping data using callback functions
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | yes
| Tickets | Fix#37597 (partially)
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/14241
Replaces https://github.com/symfony/symfony/pull/37614
## What this solves
Objects and Forms have different mechanisms for structuring data. When you build an object model with a lot of business logic it's valuable to use these mechanisms to better collect the data and the behavior that goes with it. Doing so leads to variant schemas; that is, the object model schema and the form schema don't match up.
You still need to transfer data between the two schemas, and this data transfer becomes a complexity in its own right. If the objects know about the form structure, changes in one tend to ripple to the other.
Currently, the Data Mapper layer separates the objects from the form, transfering data between the two and also isolating them from each other. That's fine, but at present the default data mapper has a limitation: _it's very tied to one property path_ (see [`PropertyPathMapper`](https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php)).
That said, you'll have to write your own data mapper in the following situations:
* When the property path differs for reading and writing
* When several form fields are mapped to a single method
* When you need to read data based on the model's state
* When the mapping of the model depends on the submitted form data
* ...
Also, when we create a new data mapper, we usually forget about checking the status of the given data and forms. Whether the data is empty or not; throw an exception if the given data is not an object/array and whether the form field is submitted/synchronized/disabled or not. Not doing that could lead to unwanted behavior.
## What this proposes
Create a new way to write and read values to/from an object/array using callback functions. This feature would be tied to each form field and would also mean a new way of mapping data, but a very convenient one, in which it won't be necessary to define a new data mapper and take into account all what it would imply when you only need to map one field in a different manner or perhaps in only one direction (writing or reading the value).
This PR adds two new options for each form type: `getter` and `setter`, allowed to be `null` or `callable`:
```php
$builder->add('name', TextType::class, [
'getter' => function (Person $person, FormInterface $form): string {
return $person->firstName().' '.$person->lastName();
},
'setter' => function (Person &$person, ?string $name, FormInterface $form): void {
$person->rename($name);
},
]);
```
This would give us the same possibilities as data mappers, but within the form field scope, where:
* `$person` is the view data, basically the underlying data to the form.
* `$form` is the current child form that is being mapped.
* `$name` is the submitted data that belongs to that field.
These two callbacks will be executed following the same rules as for property paths before read and write any value (e.i. early return if empty data, skip mapping if the form field is not mapped or it's disabled, etc).
## What this also proposes
I based the implementation on solving this problem first:
> https://github.com/symfony/symfony/pull/37614#issuecomment-662957865
> [...] the property_path option defines the rules on how it's accessed. From there, the actual way it is accessed (direct property access, accessors, reflection, whatever) are hidden from view. All that matters is the property path (which is deduced from the name if not explicitly set). [...]
So splitting the default data mapper `PropertyPathMapper` into two artifacts: "[DataMapper](https://github.com/yceruto/symfony/blob/data_accessor/src/Symfony/Component/Form/Extension/Core/DataMapper/DataMapper.php)" and "[DataAccessor](https://github.com/yceruto/symfony/blob/data_accessor/src/Symfony/Component/Form/DataAccessorInterface.php)" would allow us adding multiple data accessors along the way (the code that varies in this case) without having to reinvent the wheel over and over again (the data mapper code).
You can also think about a new `ReflectionAccessor` for instance? or use this `CallbackAccessor` to map your form partially from an external API? yes, you could do it :)
Here is a view of the proposed changes:
![data_accessor](https://user-images.githubusercontent.com/2028198/91452859-16bf8f00-e84d-11ea-8564-d497c2f73730.png)
Where "DataMapper" will take care of common checks, iterates the given child forms, manages the form data and all what is needed for mapping a standard form, whereas "DataAccessor" will take care of how to read and write values to/from the underlying object or array.
## BC
The `PropertyPathMapper` is being deprecated in favor of `DataMapper` class, which uses the `PropertyPathAccessor` by default.
Although `DataMapper` is now the default for each compound form, the behavior must remains the same (tests prove it). So that if `getter` or `setter` option is null (they're by default) the `CallbackAccessor` will falls back to `PropertyPathAccessor` either for reading or writing values.
---
Sorry for the long description, but I think that sometimes it is necessary for too complex issues and big changes. Besides, now you know a little more about what these changes is about.
/cc @xabbuh as creator of [rich-model-forms-bundle](https://github.com/sensiolabs-de/rich-model-forms-bundle) and @alcaeus as you had worked on this issue.
WDYT?
Commits
-------
878effaf47 add new way of mapping data using callback functions
This PR was merged into the 4.4 branch.
Discussion
----------
[Console] work around disabled putenv()
If this is set to true, then putenv functions simply won't be run in this script, making this function usable on servers, where putenv is disabled
| 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 -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Commits
-------
d3f909bff3 [Console] work around disabled putenv()
This PR was merged into the 5.1 branch.
Discussion
----------
[Notifier] Fix errors parsing in FirebaseTransport
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | /
| License | MIT
| Doc PR | /
I noticed that, when parsing the response, this transport use `getHeader()` like a `string[]` instead of `string[][]`.
I did not test it and I'm not sure about this fix: could you have a look @Jeroeny ?
Commits
-------
2818e2cd43 Fix errors parsing in FirebaseTransport
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | no
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
If option is `auth_ntlm` an exception is thrown, `$alternatives` then is not used.
Commits
-------
ab1a96c999 [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm
The purpose of this change is to find all usages of AbstractRendererEngine::CACHE_KEY_VAR. Currently, if you search for AbstractRendererEngine::CACHE_KEY_VAR you will see only access to it, i.e. (`$view->vars[AbstractRendererEngine::CACHE_KEY_VAR]`), but you can't find it in write level. With this pull request you can see where is was used for write.
* 5.1:
Internal classes are not legacy.
[HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
add choice_translation_domain tests to prevent further regressions
Update validators.tr.xlf
* 4.4:
Internal classes are not legacy.
[HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
add choice_translation_domain tests to prevent further regressions
Update validators.tr.xlf
* 3.4:
[HttpFoundation] Skip the cookie_max_age fixture on PHP 8.
add choice_translation_domain tests to prevent further regressions
Update validators.tr.xlf
This PR was merged into the 3.4 branch.
Discussion
----------
[DoctrineBridge] add choice_translation_domain tests to prevent further regressions
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix #https://github.com/symfony/symfony/pull/37521#issuecomment-678247192
| License | MIT
| Doc PR |
Commits
-------
7775b3707b add choice_translation_domain tests to prevent further regressions
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Messenger] - Add option to confirm message delivery in Amqp connection
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Hello! My first PR here.
Sometimes we need to be sure that messages are delivered to Amqp. To make it work we need to wait for the confirmation from the Amqp server. So let's wait for it confirmation if confirmation timeout is defined. Default behaviour are not modified - waiting for confirmation will impact performance of sending message.
Commits
-------
5682d76b2a Messenger - Add option to confirm message delivery in Amqp connection
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Cache] add integration with Messenger to allow computing cached values in a worker
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
~~This PR needs and for now embeds #30334. See 2nd commit.~~
Using the new `CacheInterface` enables probabilistic early expiration by default. This means that from time to time, items are elected as early-expired while they are still fresh ([see Wikipedia](https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration) for details).
This PR adds a new `early_expiration_message_bus` option when configuring cache pools. When this option is set, cache pools are configured to send those early-expired items on a Messenger bus, then serve the current value immediately, while the updated value is computed in a worker in the background.
`CacheInterface::get($key, $callback)` accepts any callable, but sending any callable on a bus is not possible (e.g. a `Closure` cannot be serialized). To bypass this constraint, this feature works only with callables in the form `[$service, 'publicMethod']`, where `$service` is any public or [reversible service](https://github.com/symfony/symfony/pull/30334).
This constraint is a serious one: this $service must compute a value when knowing only its key. This means keys should embed enough information for this to happen. I think that's not that hard - and we may find ways to provide additional context in the future.
At least the goal is worth it: in theory, this strategy allows achieving a 100% hit ratio even when invalidation-by-expiration is used.
There are two things one needs to do to enable this behavior:
1. bind a message bus to a cache pool:
```yaml
framework:
cache:
pools:
test.cache:
early_expiration_message_bus: messenger.default_bus
```
2. route EarlyExpirationMessage to a transport:
```yaml
framework:
messenger:
routing:
'Symfony\Component\Cache\Messenger\EarlyExpirationMessage': amqp
```
Commits
-------
6c0911f58c [Cache] add integration with Messenger to allow computing cached values in a worker
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[SecurityBundle] Comma separated ips for security.access_control
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/14219
There is currently no way to use env vars to configure `security.access_control` ips with multiple values. Ability to use comma separated ips make it able.
Commits
-------
0412e91060 [SecurityBundle] Comma separated ips for security.access_control
* 5.1:
fix merge
[Cache] fix previous PR
add mising sr (latn & cyrl) translations
[Cache] fix ProxyAdapter not persisting items with infinite expiration
[HttpClient] fail properly when the server replies with HTTP/0.9
Fix CS
[Cache] Limit cache version character range
[Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json
[String] improve fix
fix tests
[DI] dump OS-indepent paths in the compiled container
[DI] dump OS-indepent paths in the preload file
Run postgres setup trigger in transaction
allow consumers to mock all methods
* 4.4:
add mising sr (latn & cyrl) translations
[Cache] fix ProxyAdapter not persisting items with infinite expiration
[HttpClient] fail properly when the server replies with HTTP/0.9
Fix CS
[Cache] Limit cache version character range
[DI] dump OS-indepent paths in the compiled container
allow consumers to mock all methods
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpClient] fail properly when the server replies with HTTP/0.9
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37923
| License | MIT
| Doc PR | -
Commits
-------
96759af1da [HttpClient] fail properly when the server replies with HTTP/0.9
This PR was merged into the 5.2-dev branch.
Discussion
----------
Move form error normalizer to the Serializer component
| Q | A
| ------------- | ---
| Branch? | master
| 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 | n/a
Commits
-------
c053db5553 Move form error normalizer to the Serializer component
This PR was merged into the 5.1 branch.
Discussion
----------
[DI] dump OS-indepent paths in the preload file
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#38123
| License | MIT
| Doc PR | -
This allows generating the file on Windows and running it on Linux (Docker).
Commits
-------
e8feba5c36 [DI] dump OS-indepent paths in the preload file
This PR was merged into the 4.4 branch.
Discussion
----------
[DI] dump OS-indepent paths in the compiled container
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#38123
| License | MIT
| Doc PR | -
This allows compiling on Windows and running on Linux (Docker).
Commits
-------
4dcf9e7d13 [DI] dump OS-indepent paths in the compiled container
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Messenger] Added factory methods to DelayStamp for better DX
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | not necessary imho
I often find myself delaying messages for a few minutes or so and I always have to remember the `DelayStamp` uses milliseconds. I guess these simple factories could improve DX quite a bit :)
Commits
-------
fdc8da0aaa [Messenger] Added factory methods to DelayStamp for better DX
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Lock] Fix wrong interface for MongoDbStore
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | /
| License | MIT
| Doc PR | /
The MongoDbStore is not a `BlockingStore` because does not "really" implements the method `waitAndSave`.
This PR changes the interface of `MongoDbStore` and remove the dummy implementation of `waitAndSave`.
Commits
-------
4c2d32ce11 Fix wrong interface for MongoDbStore
This PR was merged into the 5.1 branch.
Discussion
----------
[Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#38146
| License | MIT
| Doc PR | -
Handles gracefully cases in which the Mailgun API does not return JSON responses.
Commits
-------
ce8f7e5c02 [Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Cache] Limit cache version character range
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | n.A.
| License | MIT
| Doc PR |
Follow up for https://github.com/symfony/symfony/pull/38108
With current HEAD in 4.4, this will fail eventually: `simple-phpunit --repeat 1000 --stop-on-failure --filter "testGetMultiple$" src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTextModeTest.php`
After this PR it will no longer fail
@nicolas-grekas
Commits
-------
15c21db856 [Cache] Limit cache version character range
This PR was merged into the 5.1 branch.
Discussion
----------
[String] improve fix
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Improves https://github.com/symfony/symfony/pull/38128
(let's wait for the CI before merging)
Commits
-------
db4b1df062 [String] improve fix
This PR was merged into the 5.1 branch.
Discussion
----------
[Messenger] Run postgres setup trigger in transaction
| Q | A
| ------------- | ---
| Branch? | 5.1 <!-- 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 | Fix#37179 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | n/a <!-- required for new features -->
This PR fix `messenger:setup-transports` command when using with ` doctrine/doctrine-bundle` version >= 2.1
Commits
-------
7ed93b4dc0 Run postgres setup trigger in transaction
This PR was merged into the 5.2-dev branch.
Discussion
----------
[AmazonSqsMessenger] Added the count message awareness on the transport
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | /
| License | MIT
| Doc PR | /
Added the possibility of have message count awareness of the receiver on the transport.
Commits
-------
96b63b83bf [AmazonSqsMessenger] Added the count message awareness on the transport
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[HttpClient] Allow to provide additional curl options to CurlHttpClient
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#37798
| License | MIT
| Doc PR | symfony/symfony-docs#14195
~~**Tagging as a draft because:**~~
- ~~there is no Doc PR Ready yet~~
- probably there are better test cases required here.
This PR introduces an option to override default curl options defined in `CurlHttpClient`. To override them, there is a special place in `$options` provided:
````php
$response = $httpClient->request('GET', 'http://your.url.here', [
'extra' => [
'curl' => [
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
]
]
]);
````
This feature is available only in `CurlHttpClient` and would be ignored in another clients.
Commits
-------
89329bd979 [HttpClient] Allow to provide additional curl options to CurlHttpClient
* 5.1:
[Intl] promote warnings to value errors on PHP 8
Fix CS
DateTime validator support for trailing data
Remove some leftover for HHVM support
Simplify code
Fix tests on 5.6
[Debug] Skip a test that was meant for HHVM.
[Console] Silence warnings on sapi_windows_cp_set() call
guard $argv + $token against null, preventing unnecessary exceptions
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Cache] Fix key encoding issue in Memcached adapter
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | n.A.
| License | MIT
| Doc PR | Fix double encoding in memcached which lead to overlong keys being generated
Because the memcached adapter uses `rawurlencode()` to encode each and every key, keys will sometimes be too long and therefore hit the memcached limit of 250 bytes. This happens when the key is small enough to be below 250 when passed to `AbstractAdapterTrait::getId()` and is then blown up over the 250 bytes limit in memcached adapter without validating the length again.
Looking through the code, it seems that the double encoding is wholly unnecessary assuming if one makes sure the namespace is properly encoded. This PR therefore removes the double encoding and instead uses rawurlencode on the namespace (which is in turn properly accounted for when calculating whether or not we are over the ID limit).
Commits
-------
23bf9be8ce [Cache] Fix key encoding issue in Memcached adapter
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[HttpClient] Fix Array to string conversion notice when parsing JSON error body with non-scalar detail property
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#38118
| License | MIT
| Doc PR | no
An earlier commit added the ability to detect common API formats and extract a useful error message from the error response payload. To achieve this, if a `title` and `detail` property are found in the error response, the response is considered to be in a known format (RFC 7807) and these values are concatenated to form a helpful error message.
However, when either `title` or `detail` property are present, but the document is not intended to follow the RFC semantics, if the properties are not scalar (e.g. if the detail property is an array of field validation violations) then the concatenation of the strings causes a notice to be raised.
This pull request checks that the `title` and `detail` properties are scalar before attempting to concatenate them. If they are not, no enhanced error message is provided.
Commits
-------
76fa884319 [HttpClient] Fix Array to string conversion notice when parsing JSON error body with non-scalar detail property
* 4.4:
[Intl] promote warnings to value errors on PHP 8
Fix CS
DateTime validator support for trailing data
Remove some leftover for HHVM support
Simplify code
Fix tests on 5.6
[Debug] Skip a test that was meant for HHVM.
[Console] Silence warnings on sapi_windows_cp_set() call
guard $argv + $token against null, preventing unnecessary exceptions
This PR was squashed before being merged into the 3.4 branch.
Discussion
----------
DateTime validator support for trailing data
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37094
| License | MIT
Commits
-------
27f6e28f5b DateTime validator support for trailing data
This PR was merged into the 5.2-dev branch.
Discussion
----------
[PropertyInfo] fix array types with keys (array<string, string>)
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | n/a
Array types with keys are currently not detected correctly from the PropertyInfo component:
```
@var array<string, string>
@var array<string, array<integer, string>>
```
Those are currently identified as object with class `rray<string, string>`.
This PR tries to fix it.
What I noticed while fixing this, is that union types in arrays are not supported in general at the moment, because the `Type` class supports only one collectionValueType and I do not see how to pass a Union Type there. But I guess that's a different issue and for those types I decided to return null as collection value type for now. (Or better throw on exception?)
Commits
-------
64f7bd7832 [PropertyInfo] fix array types with keys (array<string, string>)
* 3.4:
Fix tests on 5.6
[Debug] Skip a test that was meant for HHVM.
[Console] Silence warnings on sapi_windows_cp_set() call
guard $argv + $token against null, preventing unnecessary exceptions
This PR was merged into the 3.4 branch.
Discussion
----------
[Debug] Skip a test that was meant for HHVM
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #36872
| License | MIT
| Doc PR | N/A
This PR skips a test that fails on php 8. If I read the test correctly, it is meant to run on HHVM, so I assumed it's save to skip it if we're on PHP.
Commits
-------
bf62a4d622 [Debug] Skip a test that was meant for HHVM.
* 5.1:
[Debug] fix test
consistently use same types for strict comparisons
[PhpUnitBridge] Skip internal classes in CoverageListenerTrait
[VarExporter] unserialize() might throw an Exception on php 8.
[SecurityHttp] Don't call createMock() with multiple interfaces.
[ErrorHandler] Parse "x not found" errors correctly on php 8.
Prevent parsing invalid octal digits as octal numbers
remove unnecessary check for existing request
[DI] fix ContainerBuilder on PHP8
[Console] Make sure $maxAttempts is an int or null.
[VarDumper] Fix caster for invalid SplFileInfo objects on php 8.
[Intl] Skip test cases that produce a TypeError on php 8.
[PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
[PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
add bosnian (bs) translation
[Debug] Parse "x not found" errors correctly on php 8.
* 4.4:
[Debug] fix test
consistently use same types for strict comparisons
[PhpUnitBridge] Skip internal classes in CoverageListenerTrait
[VarExporter] unserialize() might throw an Exception on php 8.
[ErrorHandler] Parse "x not found" errors correctly on php 8.
Prevent parsing invalid octal digits as octal numbers
remove unnecessary check for existing request
[DI] fix ContainerBuilder on PHP8
[Console] Make sure $maxAttempts is an int or null.
[VarDumper] Fix caster for invalid SplFileInfo objects on php 8.
[Intl] Skip test cases that produce a TypeError on php 8.
[PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
[PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
add bosnian (bs) translation
[Debug] Parse "x not found" errors correctly on php 8.
This PR was merged into the 4.4 branch.
Discussion
----------
[Debug] fix test
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
16a76739c0 [Debug] fix test
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Process] allow setting options esp. "create_new_console" to detach a subprocess
Process.php to include support for create_new_console (Windows ONLY)
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| Bug fix? | no
| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | #36583 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Based on this issue: https://github.com/symfony/symfony/issues/36583
I created a quick repo [ https://github.com/andrei0x309/tets_sym_proc]( https://github.com/andrei0x309/tets_sym_proc) to illustrate
how this feature can be used, it essentially lets you run something even if your main script has terminated.
It is useful if you want to create something like
`new Process(['php', 'script_with_long_execution_time.php']);`
This was impossible to do on windows until the **create_new_console** flag was added in PHP 7.4.4.
With this feature Process can be used like this:
```
// Start a process and detach form it on Win only
$process = new Process(['php', 'worker.php']);
$process->setOptions(["create_new_console" => true]); // New method I added
$process->disableOutput();
$process->start();
Process Class behavior will never change if the user doesn't use setWinOptions()
```
Commits
-------
e9ab235b66 [Process] allow setting options esp. "create_new_console" to detach a subprocess
This PR was merged into the 4.4 branch.
Discussion
----------
[DependencyInjection] consistently use same types for strict comparisons
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
afc11684e0 consistently use same types for strict comparisons
* 3.4:
Prevent parsing invalid octal digits as octal numbers
[DI] fix ContainerBuilder on PHP8
[Console] Make sure $maxAttempts is an int or null.
[VarDumper] Fix caster for invalid SplFileInfo objects on php 8.
[Intl] Skip test cases that produce a TypeError on php 8.
[PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
[PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
add bosnian (bs) translation
[Debug] Parse "x not found" errors correctly on php 8.
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[PhpUnitBridge] Skip internal classes in CoverageListenerTrait
PHPUnit 9+ is picky about test covering, say, a `\RuntimeException`. Fails with the likes:
"@covers RuntimeException" is invalid
Judging by the commit e06850c12b this change is required for PHPUnit 9.1 and up. [Here's it being tested.](60c6fb972b/tests/unit/ClassMethodUnitTest.php (L49-L54))
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Follow-up to #38054
| License | MIT
Commits
-------
a0dedb9aa6 [PhpUnitBridge] Skip internal classes in CoverageListenerTrait
This PR was merged into the 4.4 branch.
Discussion
----------
[VarExporter] unserialize() might throw an Exception on php 8
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #36872
| License | MIT
| Doc PR | N/A
VarExporter attempts a deserialization in order to check if a given object can be exported in serialized form. On php 8, the `unserialize` call might throw an exception that needs to be caught and converted to the expected `NotInstantiableTypeException`.
Commits
-------
65112e11bc [VarExporter] unserialize() might throw an Exception on php 8.
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[MonologBridge] Added SwitchUserTokenProcessor to log the impersonator
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| 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 #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
This pull request adds the ability to log the impersonator user in case of user impersonation feature usage. The current TokenProcessor logs only the current token and there are no ability to simply log the original token, so we need to copy-paste the TokenProcessor and change a few lines to log the original token
Commits
-------
2f8651d4ec [MonologBridge] Added SwitchUserTokenProcessor to log the impersonator
This PR was merged into the 5.2-dev branch.
Discussion
----------
[DependencyInjection] Add the Required attribute
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | TODO
This PR proposes a new attribute `#[Required]` that can be used instead of the `@required` annotation.
Commits
-------
ea262441e7 [DependencyInjection] Add the Required attribute.
This PR was merged into the 5.2-dev branch.
Discussion
----------
[RFC][Routing] Added the Route attribute
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | not yet
I was wondering if we can make use of [attributes](https://wiki.php.net/rfc/attributes_v2) as a replacement for Doctrine Annotations for configuring routes.
I have modified the existing `AnnotationClassLoader` so that it merges attributes and annotations. This way, an application could transparently switch from annotations to attributes. Moreover, the `AnnotationClassLoader` does not require an annotation reader anymore.
Since the chosen syntax `#[…]` is treated as a comment by php 7, I was able to use the existing annotation class, which makes the migration even easier.
#### Example with Doctrine Annotations
```php
use Symfony\Component\Routing\Attribute\Route;
class ActionPathController
{
/**
* @Route("/path", name: "action")
*/
public function action()
{
}
}
```
#### Same example with the proposed Attribute
```php
use Symfony\Component\Routing\Attribute\Route;
class ActionPathController
{
#[Route('/path', name: 'action')]
public function action()
{
}
}
```
Commits
-------
f0978de493 [Routing] Added the Route attribute.
This PR was merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] generate preload.php in src/ to make opcache.preload predictable
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
As seen in https://github.com/symfonycorp/cloud-templates/pull/15, having the path of the preload file vary by env+debug makes configuring PHP.ini settings impossible.
This PR dump a new `preload.php` file in `src/` when `cache:clear` is called.
This makes the path predictable.
This is submitted as a bugfix because the current behavior is barely usable without this change.
Commits
-------
54c965c7d0 [FrameworkBundle] generate preload.php in src/ to make opcache.preload predictable
* 4.4:
[HttpKernel] Adjust tests to new "class not found" error message format.
Don't call createMock with an array of interfaces.
[FrameworkBundle] Fix Tests on PHPUnit 9.3.
[WebProfilerBundle] Fix Tests on PHPUnit 9.3.
esmtp error not being thrown properly
[Yaml Parser] fixed Parser to skip comments when inlining sequences
[DI] fix generating preload file when cache_dir is outside project_dir
Fix CacheCollectorPass with decorated cache pools
[PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
Remove invalid instantiation declaration
[PropertyInfo] Fix typed collections in PHP 7.4
This PR was merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] Fix Tests on PHPUnit 9.3
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #37564
| License | MIT
| Doc PR | N/A
When joining two constraints with a `LogicalAnd`, PHPUnit will generate a failure message where the message omitted by the first constraint will be wrapped in parenthesis. I'm using a regular expression now, so we can support both variants.
Commits
-------
8bc36d7420 [FrameworkBundle] Fix Tests on PHPUnit 9.3.
This PR was merged into the 4.4 branch.
Discussion
----------
[WebProfilerBundle] Fix Tests for PHPUnit 9.3
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #37564
| License | MIT
| Doc PR | N/A
PHPUnit's `logicalXor()` creates an XOR operation for one or multiple constraints. It expects the operands for that operation to be passed as variadic arguments, but this particullar test passes them in a single array.
This somewhat works on PHPUnit 8, but fails on PHPUnit 9. This PR fixes the failing test.
Commits
-------
f290b97d4f [WebProfilerBundle] Fix Tests on PHPUnit 9.3.
This PR was merged into the 4.4 branch.
Discussion
----------
Don't call createMock with an array of interfaces
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #37564
| License | MIT
| Doc PR | N/A
PHPUnit 8 allows us to pass an array of interfaces to `createMock()`. The result was a mock object that implemented all of the given interfaces. This feature has sadly been removed (see sebastianbergmann/phpunit#3955), which forces us to create dummy classes that can be mocked instead. I've done this already on the 3.4 branch with #37566.
This PR fixes all affected tests (that I could find) on the 4.4 branch.
Commits
-------
a8e762d8c3 Don't call createMock with an array of interfaces.
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpKernel] Adjust tests to new "class not found" error message format
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #36872
| License | MIT
| Doc PR | N/A
Commits
-------
5b95bcd009 [HttpKernel] Adjust tests to new "class not found" error message format.
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Notifier] Register NotificationDataCollector and NotificationLoggerListener service
| Q | A
| ------------- | ---
| Branch? | master<!-- 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 | Fix#38009 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | - <!-- 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
-------
1beffd1363 Register NotificationDataCollector and NotificationLoggerListener
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Yaml Parser] fixed Parser to skip comments when inlining sequences
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37972
| License | MIT
The parser didn't skip comments when parsing values in a sequence. This resulted in the YamlFileLoader trying to
parse a comment as a IteratorArgument which resulted in a InvalidArgumentException.
Consider the following valid yaml:
```yaml
- !foo [
bar,
#baz
]
```
The parser would generate the following array:
```php
['bar', '#baz']
```
After this fix the parser will generate the following array:
```php
['bar']
```
This bug only appeared for me in 4.4
Commits
-------
b5316ebebb [Yaml Parser] fixed Parser to skip comments when inlining sequences
This PR was merged into the 3.4 branch.
Discussion
----------
[PhpUnitBridge] Adjust output parsing of CoverageListenerTrait for PHPUnit 9.3
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #37637, #37564
| License | MIT
| Doc PR | N/A
This PR makes `CoverageListenerTrait` pass with PHPUnit 9.3. It contains a backport of #38054.
The problem that is addressed here is that a one of the fixture classes is now included in the output despite having a coverage of zero. The test now accepts both cases:
* The class is omitted from the output
* The class appears with 0.00% coverage.
Commits
-------
a3831dc0f2 [PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
99c98bd716 [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
This PR was merged into the 3.4 branch.
Discussion
----------
[Intl] Skip test cases that produce a TypeError on php 8
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #36872
| License | MIT
| Doc PR | N/A
On php 8, `NumberFormatter::setAttribute()` will throw a type error if the provided value is not of type `int|float`. This is why I'm skipping the corresponding tests for now. Alternatively, we could check for the PHP version in Symfony's implementation of that class and throw the `TypeError` as well, if we're on php 8. But since this is a breaking change, I'm was unsure if I sould go that way.
Commits
-------
7f1055b97c [Intl] Skip test cases that produce a TypeError on php 8.
This PR was merged into the 4.4 branch.
Discussion
----------
[Cache] Fix CacheCollectorPass with decorated cache pools
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#38055
| License | MIT
| Doc PR |
The `getDefinition` call in `addToCollector` does not work when the service is decorated. Also instances will be added with the decoration name. This looks weird in the profiler. I have changed it to prefer the attribute name.
Before:
![image](https://user-images.githubusercontent.com/6224096/92225243-3be27c00-eea3-11ea-8bd5-2ae69212e658.png)
After: (`\Shopware\Storefront\Framework\Cache\CacheDecorator` did go into `cache.object`)
![image](https://user-images.githubusercontent.com/6224096/92225284-47ce3e00-eea3-11ea-885f-cdba95b89302.png)
Commits
-------
973442759c Fix CacheCollectorPass with decorated cache pools
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
Updated to use `PHPUnit\Util\Annotation\Registry` and related classes.
Fixes#37637
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#37637
| License | MIT
| Doc PR | n/a
- [x] Fixes the issue under PHPUnit 8.5+
- [ ] Tests TBD
If this is a sensible approach, I will try to add a test for this addition.
Commits
-------
5f83811002 [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x
This PR was merged into the 4.4 branch.
Discussion
----------
[PropertyInfo] Fix typed collections in PHP 7.4
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | No ticket
| License | MIT
| Doc PR | N/A
#37971 introduced support for typed properties in PHP 7.4, however by short circuiting the `getTypes()` method, typed collections are returned as `Type::BUILTIN_TYPE_ARRAY` without a proper collection type. If running on PHP < 7.4, the `getMutator()` method would be called which would extract the collection type from the getter/setter or adder/remover.
I updated the typedPropertiesTest to cover this case.
Commits
-------
282ed2850c [PropertyInfo] Fix typed collections in PHP 7.4
This PR was merged into the 5.2-dev branch.
Discussion
----------
Increase HttpBrowser::getHeaders() visibility to protected
Resolves symfony/symfony#38051
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#38051
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Increases visibility to allow for oddball header overrides; see #38051 for more detail.
If this looks good, let me know if this is worth adding docs/changelog entries and I'll do so.
Commits
-------
3d75ab515f Increase HttpBrowser::getHeaders() visibility to protected
This PR was merged into the 5.2-dev branch.
Discussion
----------
Add tests for translated error messages of json authentication
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | #33168
| License | MIT
| Doc PR | -
In PR #38037 i added the translator to the json authenticator but there are some tests missing. I added some now.
Commits
-------
b50fc19af0 Add tests for translated error messages of json authentication
* 5.1:
Enable "native_constant_invocation" CS rule
Make AbstractPhpFileCacheWarmer public
Fix CS
Add a warning comment on ldap empty password
Bump Symfony version to 4.4.14
Update VERSION for 4.4.13
Update CHANGELOG for 4.4.13
[PhpunitBridge] Fix deprecation type detection
* origin/4.4:
Fix CS
Add a warning comment on ldap empty password
Bump Symfony version to 4.4.14
Update VERSION for 4.4.13
Update CHANGELOG for 4.4.13
[PhpunitBridge] Fix deprecation type detection
This PR was merged into the 5.1 branch.
Discussion
----------
[PHPUnitBridge] Fix deprecation type detection when trigger_deprecation is used
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
when trigger_deprecation is used, the deprecation types (self, direct, indirect) are not properly detected because the file where the deprecation come from is always `deprecation-contracts/functions.php`. This PR aims to fix that.
Commits
-------
fd39961180 [PHPUnitBridge] Fix deprecation type detection when trigger_deprecation is used
This PR was merged into the 4.4 branch.
Discussion
----------
[PhpunitBridge] Fix deprecation type detection (when several autoload files are used)
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Several autoload files are supported by the PHPUnit Bridge but when the internal paths are registered (for deprecation type detection), the paths (from prefixes) of the last autoload file override the paths previously registered. This PR fixes this bug.
Commits
-------
cc7b6c5e5a [PhpunitBridge] Fix deprecation type detection
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Cache] give control over cache prefix seed
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets |
| License | MIT
| Doc PR |
Reopened#35723 for master.
The configurable cache prefix seed does not give full control over the cache prefix because the container class is added to the prefix in any case. This is a problem because the container class contains the app env name. We use different app environments for different deployment targets (dev and test). We want dev and test to use the same redis cache. But this is impossible to achieve because even setting the cache prefix seed does not accomplish this.
Commits
-------
6681b92524 [Cache] give control over cache prefix seed
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Security] Configurable execution order for firewall listeners
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| License | MIT
| Doc PR | n/a
Hello there, I'm the author of `scheb/two-factor-bundle`, which extends Symfony's security layer with two-factor authentication. I've been closely following the recent changes by @wouterj to rework the security layer with "authenticators" (great work!). While I managed to make my bundle work with authenticators, I see some limitations in the security layer that I'd like to address to make such extensions easier to implement.
In #37336 I've submitted a draft to let security factories add their own authentication listeners to the firewall. This PR is intended to address the issue of execution order. If you look at the `Firewall` class
f64f59a9c0/src/Symfony/Component/Security/Http/Firewall.php (L62-L82)
authentication listeners are executed in the order of their creation. Additionally, there's hardcoded logic to execute `Symfony\Component\Security\Http\Firewall\AccessListener` always last and the logout listener second to last. I'd like to have a more flexible approach, to remove the hardcoded order and give authentication listeners the ability to determine their execution order.
I've added an optional interface to provide a priority to sort all registered authenitication listeners. Sorting is done in a compiler pass, so no time is wasted at runtime.
This is a draft, so I'd like to hear your opinion on this :)
Commits
-------
91388e871b Add ability to prioritize firewall listeners
The configurable cache prefix seed does not give full control over the cache prefix because the container class is added to the prefix in any case. This is a problem because the container class contains the app env name. We use different app environments for different deployment targets (dev and test). Dev and test should use the same redis cache. But this is impossible to achieve because even setting the cache prefix seed does not accomplish this.
This PR was merged into the 5.2-dev branch.
Discussion
----------
[PHPUnitBridge] deprecations not disabled anymore when disabled=0
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? |
| Tickets |
| License | MIT
| Doc PR |
According to the [docs](https://symfony.com/doc/current/components/phpunit_bridge.html#disabling-the-deprecation-helper), `disabled=1` turns off deprecations mode on phpunit-bridge. It's not totally true since deprecations are disabled as soon as `disabled` key is present in `SYMFONY_DEPRECATIONS_HELPER`. So if `disabled=0` deprecations are still disabled.
Instead of updating the doc, this PR suggest to make `disabled` behavior consistent with `verbose` behavior, so:
- `disabled` => deprecations disabled
- `disabled=0` => deprecations enabled
- `disabled=1` => deprecations disabled
Commits
-------
6908e3d156 [PHPUnitBridge] deprecations not enabled anymore when disabled=0
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Form] dispatch submit events for disabled forms too
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #27217
| License | MIT
| Doc PR |
TODO:
- [ ] add a test case covering the validation use case
Commits
-------
6da42ae2d1 dispatch submit events for disabled forms too
This PR was merged into the 5.1 branch.
Discussion
----------
stop using the deprecated at() PHPUnit matcher
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
e36e73b9cf stop using the deprecated at() PHPUnit matcher
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
Added support for using the "{{ label }}" placeholder in constraint messages
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | #12238
| License | MIT
| Doc PR |
- [ ] Add docs PR
Commits
-------
0d9f44235c Added support for using the "{{ label }}" placeholder in constraint messages
* 5.1:
[Mailer] Fixed 'verify_peer' option in mailer DSN being ignored
[Cache] Psr16Cache does not handle Proxy cache items
[Serializer] fixed fix encoding of cache keys with anonymous classes
Fix symfony/amazon-mailer constraint
[Validator] Fix PhpUnitBridge version constraint.
Bump Symfony version to 5.1.5
Update VERSION for 5.1.4
Update CHANGELOG for 5.1.4
Bump Symfony version to 4.4.13
Update VERSION for 4.4.12
Update CHANGELOG for 4.4.12
Bump Symfony version to 3.4.45
Update VERSION for 3.4.44
Update CONTRIBUTORS for 3.4.44
Update CHANGELOG for 3.4.44
* 4.4:
[Cache] Psr16Cache does not handle Proxy cache items
[Serializer] fixed fix encoding of cache keys with anonymous classes
Bump Symfony version to 4.4.13
Update VERSION for 4.4.12
Update CHANGELOG for 4.4.12
Bump Symfony version to 3.4.45
Update VERSION for 3.4.44
Update CONTRIBUTORS for 3.4.44
Update CHANGELOG for 3.4.44
This PR was squashed before being merged into the 5.1 branch.
Discussion
----------
[Mailer] Fixed 'verify_peer' option in mailer DSN being ignored
| Q | A
| ------------- | ---
| Branch? | 5.1 <!-- 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 | N/A <!-- required for new features -->
The mailer DSN option 'verify_peer' was being ignored because `$dsn->getOption('verify_peer', true)` was returning a string and thus NOT operator on it was always resulting in false. I propose changing the line where it is used with a `filter_var` call with the `FILTER_VALIDATE_BOOLEAN` as the filter parameter to overcome this issue.
Commits
-------
1c789e87aa [Mailer] Fixed 'verify_peer' option in mailer DSN being ignored
This PR was merged into the 4.4 branch.
Discussion
----------
[Cache] Psr16Cache does not handle Proxy cache items
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#38006
| License | MIT
Add test for Psr16Cache along with a ProxyAdapter
Commits
-------
e525fa1055 [Cache] Psr16Cache does not handle Proxy cache items
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Serializer] fixed fix encoding of cache keys with anonymous classes
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#36589
| License | MIT
| Doc PR | -
Commits
-------
3a4675359d [Serializer] fixed fix encoding of cache keys with anonymous classes
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Console] Remove restriction for choices to be strings
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#34789
| License | MIT
When using choice, selected answers are forced into strings, preventing us from using complex values such as a class with a custom __toString. This is a problem, as I need the ability to present the user with a list of display strings to choose from, but need the ID associated with that display string in order to do anything useful.
Commits
-------
d276cc9ca3 [Console] Cast associative choices questions keys to string
a0223088a0 [Console] Add tests for removing restriction for choices to be strings
3349d3ce89 Remove restriction for choices to be strings
This PR was merged into the 5.1 branch.
Discussion
----------
[Validator] Fix PhpUnitBridge version constraint
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
This PR allows Validator 5.1 and PhpUnitBridge 5.1 to be installed alongside each other.
Commits
-------
1055a7f29b [Validator] Fix PhpUnitBridge version constraint.
This PR was merged into the 5.2-dev branch.
Discussion
----------
Remove unneeded code
| Q | A
| ------------- | ---
| Branch? | master
| 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
Commits
-------
5ed8ebe50e Remove unneeded code
* 5.1:
Fix CS
[HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
[FrameworkBundle] Do not pass the base uri twice to scoped http clients
* 4.4:
Fix CS
[HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
[FrameworkBundle] Do not pass the base uri twice to scoped http clients
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Workflow] Expose the Metadata Store in the DIC
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37955
| License | MIT
| Doc PR |
I did not updated the CHANGELOG, because IMHO it not worth it
Commits
-------
aa7a444c86 [Workflow] Expose the Metadata Store in the DIC
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[Translation] Add support for calling 'trans' with ICU formatted messages
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | maybe, see https://github.com/symfony/symfony/issues/37228
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#37228
| License | MIT
| Doc PR | symfony/symfony-docs#13875
Motivation:
```
$apples = [0 => 'No apples', 1 => '1 apple', '# apples'];
echo _m($apples, ['count' => 0]); // Outputs 'No apples'
echo _m($apples, ['count' => 2]); // Outputs '2 apples'
```
where `_m` is a wrapper my application is using, but we obviously don't want to replicate many of the effort of the translation component, so it relies on `trans`.
This wrapper itself could be integrated into Symfony, if deemed appropriate.
See #37228
Commits
-------
d2ec41f4ef [Translation] Add support for calling 'trans' with ICU formatted messages
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
The current message is `TypeError: Argument 4 passed to Symfony\Component\HttpClient\Response\MockResponse::fromRequest() must implement interface Symfony\Contracts\HttpClient\ResponseInterface, instance of Generator given`.
I lost some time with this because I was passing a callable that returns a \Generator instead of passing the resulting \Generator directly. We could support that case but I guess with the added exception message, it is clear we don't support it at all.
Commits
-------
564dce39f8 [HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
This PR was merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] Do not pass the base uri twice to scoped http clients
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
I looked at my dumped scoped http client PHP file and I noticed the base uri was passed two times. I thought there was a bug somewhere in my configuration. Actually, we only need to pass it as the method argument here.
Commits
-------
e2fce0d89f [FrameworkBundle] Do not pass the base uri twice to scoped http clients
* 5.1:
[PhpUnitBridge] Create a predictable symlink pointing to the local install
[PropertyInfo] Backport support for typed properties (PHP 7.4)
[PhpUnitBridge] Polyfill new phpunit 9.1 assertions
[PhpUnitBridge] Move assertMatchesRegularExpression in PolyfillAssertTrait
[PhpUnit] Add polyfill for assertMatchesRegularExpression()
Update Notifier bridge readme
[TwigBridge] Fix#37931: BC break where filter method `trans` did not allow null values for `$message` parameter anymore
[PropertyAccess] Fix accessing dynamic properties
* 4.4:
[PhpUnitBridge] Create a predictable symlink pointing to the local install
[PropertyInfo] Backport support for typed properties (PHP 7.4)
[PhpUnitBridge] Polyfill new phpunit 9.1 assertions
[PhpUnitBridge] Move assertMatchesRegularExpression in PolyfillAssertTrait
[PhpUnit] Add polyfill for assertMatchesRegularExpression()
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)
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
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
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
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
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
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
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
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.
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
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
* 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
This PR was merged into the 5.2-dev branch.
Discussion
----------
[lock] Lazy create table in lock PDO store
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | /
| License | MIT
| Doc PR | TODO
With this PR, the table used by PdoStore is automatically created (similar to Cache and Messenger componenents)
Commits
-------
eaa52bae96 Lazy create table in lock PDO store
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
Allow Drupal to wrap the Symfony test listener
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | kinda
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Drupal has a test listener that wraps the Symfony listener as we need to manipulate deprecation testing to skip specific deprecations. We've managed to remove some how custom stuff and reaching into Symfony's privates via reflection recently (and fix a bug or two) but now we're getting output like:
```
2x: a:4:{s:11:"deprecation";s:191:"Calling Drupal\Tests\WebAssert::responseNotMatches with more than one argument is deprecated in drupal:9.1.0 and will throw an exception in drupal:10.0.0. See https://www.drupal.org/node/TODO";s:5:"class";s:52:"Drupal\Tests\comment\Functional\CommentAnonymousTest";s:6:"method";s:13:"testAnonymous";s:15:"triggering_file";s:74:"/Users/alex/dev/sites/drupal8alt.dev/core/tests/Drupal/Tests/WebAssert.php";}
2x in DrupalListener::endTest from Drupal\Tests\Listeners
```
instead of
```
2x: Calling Drupal\Tests\WebAssert::responseNotMatches with more than one argument is deprecated in drupal:9.1.0 and will throw an exception in drupal:10.0.0. See https://www.drupal.org/node/TODO
2x in CommentAnonymousTest::testAnonymous from Drupal\Tests\comment\Functional
```
We can fix this by aliasing and copying the \Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation class but ideally that class could be a bit more liberal in its implementation.
Commits
-------
91de46da3f Allow Drupal to wrap the Symfony test listener
This PR was merged into the 5.1 branch.
Discussion
----------
[Notifier] backport documentation changes
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
I think #37809 should have been merged into the `5.1` branch.
Commits
-------
ff768fbdd9 [Notifier] add doc for free mobile dsn
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[Messenger] Add FlattenException Normalizer
| 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#32719 ... <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | No 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/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.
-->
I have just duplicated the PR https://github.com/symfony/symfony/pull/33650 (from @skalpa) but using the new component ErrorHandler and removing the priority.
Project that reproduces the bug on Symfony 5.2: https://github.com/monteiro/serializer-pr37087 (all steps are on the README).
Since this adds a new class and changes behavior, we add this new feature on the 5.2 branch.
Commits
-------
78fbd0ac77 [Messenger] Add FlattenException Normalizer
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Security] Pass Passport to LoginFailureEvent
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#37585
| License | MIT
| Doc PR | -
This changes passes a `Passport` to the `LoginFailureEvent`.
Commits
-------
d23434bc23 [Security] Pass Passport to LoginFailureEvent
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[HttpFoundation] add support for X_FORWARDED_PREFIX header
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#36809
| License | MIT
Add support for `X-Forwarded-Prefix` header added by the popular Traefik HTTP LoadBalancer and Reverse Proxy. This ensures that the links rendered by symfony application deployed behind LB are valid even if the application is deployed via prefix URL.
Example routing setup:
route `/admin/(.*)` => symfony backend `/$1`
in this case links rendered by symfony backend must start with `/admin/`
To accept traefik prefix in your symfony app, you must modify index.php to allow accepting this header:
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_TRAEFIK ^ Request::HEADER_X_FORWARDED_HOST );`
Commits
-------
109e0a9f1a [HttpFoundation] add support for X_FORWARDED_PREFIX header
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Mailer] Support Amazon SES ConfigurationSetName
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
In Amazon SES a Configuration Set can be used to monitor email sending
events (delivery, bounces, complaints etc.). In order to use this
feature the ConfigurationSetName needs to be sent along with the email.
Setting the `X-SES-CONFIGURATION-SET` header should accomplish this for
all SES Transports now.
Ref: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-configuration-sets-in-email.html
Commits
-------
a36fec3204 [Mailer] Support Amazon SES ConfigurationSetName
In Amazon SES a Configuration Set can be used to monitor email sending
events (delivery, bounces, complaints etc.). In order to use this
feature the ConfigurationSetName needs to be sent along with the email.
Setting the `X-SES-CONFIGURATION-SET` header should accomplish this for
all SES Transports now.
Ref: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-configuration-sets-in-email.html
This PR was merged into the 5.2-dev branch.
Discussion
----------
[FrameworkBundle] properly choose the best mailer message logger listener
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Properly merge the changes from #37729 and #37728.
Commits
-------
6cffc79de6 properly choose the best mailer message logger listener
This PR was merged into the 4.4 branch.
Discussion
----------
[Messenger] stop using the deprecated schema synchronizer API
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
see the failing tests and doctrine/dbal#4213
Commits
-------
40129d6239 stop using the deprecated schema synchronizer API