This PR was merged into the 4.1 branch.
Discussion
----------
[Messenger] send using the routing_key for AMQP transport
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28133
| License | MIT
| Doc PR | -
Shouldn't we publish using the routing_key that is used by the listening queue?
Commits
-------
666d2d962b [Messenger] send using the routing_key for AMQP transport
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] If `framework.messenger.buses.X.middleware` is empty, it will be `null`
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28945
| License | MIT
| Doc PR | ø
Otherwise, it would fail with the following configuration:
```yaml
framework:
messenger:
buses:
events_bus:
middleware:
# - 'some_commented_middleware'
```
Commits
-------
91a70fcd6f If `framework.messenger.buses.X.middleware` is empty, it will be `null`
This PR was merged into the 4.2-dev branch.
Discussion
----------
Fix typo in Messenger examples
| Q | A
| ------------- | ---
| Branch? | master for features / 2.8 up to 4.1 for bug fixes <!-- see below -->
| Bug fix? | no
| New feature? | yes/no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Fixed a typo in UPGRADE-4.2.md.
Commits
-------
7da59432cd Fix typo in Messenger examples
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Form] Deprecate TimezoneType regions option
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #28848
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
I know i've added this option myself in 4.1, but given my recent development for #28624 i realized it's an opinionated feaure, which can/should be solved on user-side (`choice_filter/choice_loader` and/or `group_by`).
- blocks translations as we dont have them (see #28831)
- blocks possibility of switching to Intl zones which doesnt really have this filter feature (see #28836)
~While at it, i solved a few issues with `OptionsResolver` that is able to deprecate options as of 4.2 also.~ Fixed in #28878
- when resolved trigger the deprecation
- allow to opt-out from triggering the deprecation
- dont trigger deprecation for default values (only given ones)
Commits
-------
5cb532d2de [Form] Deprecate TimezoneType regions option
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] remove AllowNoHandlerMiddleware in favor of a constructor argument on HandleMessageMiddleware
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
`AllowNoHandlerMiddleware` adds a frame in the call stack but its concern should be handled by `HandleMessageMiddleware` to me, and `HandlerLocatorInterface::getHandler()` should not care about whether it's an error or not to not have a middleware (this makes it on par with `SenderLocator` in this regard.)
Commits
-------
aedb281b76 [Messenger] remove AllowNoHandlerMiddleware in favor of a constructor argument on HandleMessageMiddleware
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] remove classifying sub-namespaces in favor of semantic ones
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
While working on the component, I found it hard to discover the meaning of the `Asynchronous` and `Enhancers` sub-namespaces. Now that I know the component better, I understand they're only classifying namespaces with no specific technical semantics.
I'd like to remove them to make the component easier to discover.
This PR introduces a few new semantic sub-namespaces instead.
From the changelog:
* Classes in the `Middleware\Enhancers` sub-namespace have been moved to the `Middleware` one
* Classes in the `Asynchronous\Routing` sub-namespace have been moved to the `Transport\Sender\Locator` sub-namespace
* The `Asynchronous/Middleware/SendMessageMiddleware` class has been moved to the `Middleware` namespace
* `SenderInterface` and `ChainSender` classes have been moved to the `Transport\Sender` sub-namespace
* `ReceiverInterface` and its implementations have been moved to the `Transport\Receiver` sub-namespace
Commits
-------
16afb5e2b4 [Messenger] remove classifying sub-namespaces in favor of semantic ones
This PR was merged into the 4.2-dev branch.
Discussion
----------
[OptionsResolver] Fixed explicitly ignores a depreciation
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/28860#issuecomment-432560319
| License | MIT
| Doc PR | -
When a deprecated option with default value was resolved (the first time it's called) in this case through a lazy evaluation, [the default resolution process](8398947c9c/src/Symfony/Component/OptionsResolver/OptionsResolver.php (L771-L773)) takes the resolved value and here should also trigger only if the option was provided by the user or is being called from a lazy evaluation, otherwise ignore.
Commits
-------
8398947c9c Fixed explicitly ignores a depreciation
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Process] pass all output to the wait-until callback
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? |
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Introduced yesterday, my bad.
Should make appveyor green hopefully.
Commits
-------
a320133b1d [Process] pass all output to the wait-until callback
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Validator] catch any UnexpectedValueException on validation
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #12312
| License | MIT
| Doc PR |
Commits
-------
fa3586029f catch any UnexpectedValueException on validation
This PR was merged into the 4.1 branch.
Discussion
----------
also clean away the NO_AUTO_CACHE_CONTROL_HEADER if we have no session
| Q | A
| ------------- | ---
| Branch? | 4.1 (feature added in this branch)
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This header is not supposed to ever be exposed to clients of the application, but a hack to transfer information within the symfony application. This bugfix makes it so that we also remove the header when no session is started and thus no decision has to be taken whether to overwrite the caching instructions or not.
Commits
-------
28d9f0c84c also clean away the NO_AUTO_CACHE_CONTROL_HEADER if we have no session
This PR was squashed before being merged into the 4.2-dev branch (closes#28875).
Discussion
----------
[FWBundle] Add a new method AbstractController::addLink()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? |no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | todo
This provides a convenient method to add `Link` headers to the current `Response` directly from the `Request` object.
It improves the developer experience and the discoverability of [the WebLink component](https://github.com/symfony/symfony-docs/pull/10309).
Usage:
```php
namespace App\Controller;
use Fig\Link\Link;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class MyAction extends AbstractController
{
public function __invoke(Request $request): Response
{
$this->addLink($request, new Link('mercure', 'https://demo.mercure.rocks'));
return $this->json(['foo' => 'bar']);
}
}
```
Commits
-------
4d20c39f70 [FWBundle] Add a new method AbstractController::addLink()
This PR was merged into the 4.2-dev branch.
Discussion
----------
[OptionsResolver] Trigger deprecation only if the option is used
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28848
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/10496
It's true that showing a deprecation message when the option is not used is a bit annoying and it would be heavy to get rid of it.
Now, a deprecated option is triggered only when it's provided by the user or each time is being called from a lazy evaluation (except for deprecations based on the value, they're triggered only when provided by the user).
Commits
-------
1af23c9a74 [OptionsResolver] Trigger deprecation only if the option is used
This PR was squashed before being merged into the 4.2-dev branch (closes#28939).
Discussion
----------
[WebProfilerBundle] Remove application name
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
This fixes a regression in master, i think after #28809 (or something related)
There's still a "application name" concept out there today, and it's `ConfigDataCollector::getApplicationName()` 🤔
In my case the service resolved to
```php
$e = new \Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector(\basename('/app'));
```
Causing the app name to be, well, `app` (again :P). It was really confusing.
Before:
![image](https://user-images.githubusercontent.com/1047696/47264761-fcb01980-d51c-11e8-9a3b-14a43d18b179.png)
(the "a" is from "app" here)
After:
![image](https://user-images.githubusercontent.com/1047696/47264767-16516100-d51d-11e8-8a5d-4c20d4911861.png)
or
![image](https://user-images.githubusercontent.com/1047696/47264774-28cb9a80-d51d-11e8-8fe6-de0f46b06a1d.png)
I think we need to deprecate the argument for real?
cc @fabpot
Commits
-------
f5c355e1ba [WebProfilerBundle] Remove application name
This PR was squashed before being merged into the 4.2-dev branch (closes#28940).
Discussion
----------
[Process] Adds usleep(1000) to ease CPU usage.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | symfony/symfony-docs
Commits
-------
9d1416ad82 [Process] Adds usleep(1000) to ease CPU usage.
This PR was squashed before being merged into the 4.2-dev branch (closes#28737).
Discussion
----------
[DependencyInjection] Optimize exporting variables
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28292
| License | MIT
Store previously resolved variables so that the relatively expensive function [resolveEnvPlaceholders](3e7b029524/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php (L1776)) is not called unnecessarily.
The effect on running ```bin/console``` with an empty cache in a big application (200+ env variables) in seconds:
| Before | After |
|------------|------------|
| 24.1 | 15.8 |
| 24.5 | 16.0 |
| 24.7 | 16.3 |
| 24.2 | 16.0 |
| Avg: 24.4 | Avg:16.0 |
Commits
-------
768de2f7d9 [DependencyInjection] Optimize exporting variables
This PR was squashed before being merged into the 4.2-dev branch (closes#28200).
Discussion
----------
[Config] Fix slow service discovery for large excluded directories
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | #26736
| License | MIT
| Doc PR |
Not sure if this is a bug fix or not, is more an improvement.
Please for all detail follow the conversation here:
https://github.com/symfony/symfony/issues/26736
Commits
-------
fa731e53e9 [Config] Fix slow service discovery for large excluded directories
This PR was squashed before being merged into the 4.2-dev branch (closes#28709).
Discussion
----------
[Serializer] Refactor and uniformize the config by introducing a default context
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | todo <!-- required for new features -->
This PR uniformizes how the Serializer's configuration is handled:
* As currently, configuration options can be set using the context (options that weren't configurable using the context have been refactored to leverage it)
* Normalizers and encoders' constructors now accept a "default context"
* All existing global configuration flags (constructor parameters) have been deprecated in favor of this new default context
* the stateless context is always tried first, then is the default context
Some examples:
```php
// Configuring groups globally
// Before: not possible
// After
$normalizer = new ObjectNormalizer(/* deps */, ['groups' => 'the_default_group']);
// Escaping Excel-like formulas in CSV files
// Before
$encoder = new CsvEncoder(',', '"', '\\', '.', true);
// After
$encoder = new CsvEncoder(['csv_escape_formulas' => true]);
$encoder->normalize($data, 'csv', ['csv_escape_formulas' => false]); // Override for this call only
```
Benefits:
* The DX is dramatically improved, configuration is always handled in similar way
* The serializer can be used in fully stateless way
* Every options can be configured globally
* Classes that had constructors with a lot of parameters (like `CsvEncoder`) are now much easier to use
* We'll be able to improve the documentation by adding a dictionary of all available context options for the whole component
* Everything can be configured the same way
TODO in subsequent PRs:
* Add a new option in framework bundle to configure the context globally
* Uniformize the constants name (sometimes the name if `FOO`, sometimes `FOO_KEY`)
* Fix the "bug" regarding the format configuration in `DateTimeNormalizer::denormalize()` (see comments)
* Maybe: move `$defaultContext` as the first parameter (before required services?)
* Make `XmlEncoder` stateless
Commits
-------
52b186a210 [Serializer] Refactor and uniformize the config by introducing a default context
This PR was merged into the 4.2-dev branch.
Discussion
----------
[HttpFoundation] Merging arrays in a loop is slow and causes high CPU usage
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
As described here, https://github.com/kalessil/phpinspectionsea/blob/master/docs/performance.md#slow-array-function-used-in-loop, merging arrays in a loop is slow and causes high CPU usage (benchmarks are also on the link), this pull request solves this problem
Commits
-------
3db84789f2 Merging arrays in a loop is slow and causes high CPU usage
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] internal cleanups
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
From the updated changelog:
* `MessengerDataCollector::getMessages()` returns an iterable, not just an array anymore
* `AbstractHandlerLocator` is now internal
* `HandlerLocatorInterface::resolve()` has been replaced by `getHandler(Envelope $envelope)`
* `SenderLocatorInterface::getSenderForMessage()` has been replaced by `getSender(Envelope $envelope)`
* `SenderInterface::send()` returns `void`
+ some internal simplifications
Commits
-------
4a3edd0b37 [Messenger] internal cleanups