* 4.4:
[Validator] RangeTest: fix expected deprecation
[Yaml] Fix for #36624; Allow PHP constant as first key in block
Use PHPUnit 9.3 on php 8.
fix mapping errors from unmapped forms
[Validator] Add target guards for Composite nested constraints
* 3.4:
[Yaml] Fix for #36624; Allow PHP constant as first key in block
Use PHPUnit 9.3 on php 8.
fix mapping errors from unmapped forms
[Validator] Add target guards for Composite nested constraints
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Console] Different approach on merging application definition
| Q | A |
| --- | --- |
| Branch? | "master" |
| Bug fix? | yes |
| New feature? | not really (refactoring) |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #19181, #17804, #19909, partially #20030 |
| License | MIT |
| Doc PR | reference to the documentation PR, if any |
Before/After:
``` diff
$ bin/console list -h
Usage:
list [options] [--] [<namespace>]
Arguments:
namespace The namespace name
Options:
--raw To output raw command list
--format=FORMAT The output format (txt, xml, json, or md) [default: "txt"]
+ -h, --help Display this help message
+ -q, --quiet Do not output any message
+ -V, --version Display this application version
+ --ansi Force ANSI output
+ --no-ansi Disable ANSI output
+ -n, --no-interaction Do not ask any interactive question
+ -e, --env=ENV The environment name [default: "dev"]
+ --no-debug Switches off debug mode
+ -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
The list command lists all commands:
php bin/console list
You can also display the commands for a specific namespace:
php bin/console list test
You can also output the information in other formats by using the --format option:
php bin/console list --format=xml
It's also possible to get raw list of commands (useful for embedding command runner):
php bin/console list --raw
```
This could deprecate `getNativeDefinition` or make it a feature as right now it's internal and unused.
edit: resolved the BC break.
edit2: question is.. should this target 2.7?
Commits
-------
553b173a30 [Console] Different approach on merging application definition
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Notifier] Add Mobyt bridge
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | #33687
| License | MIT
| Doc PR | symfony/symfony-docs#13606
| recipe PR | symfony/recipes#768
Add Mobyt notifier bridge.
In this SMS Provider, you can choose a sort of "quality service" to send the message.
I updated `src/Symfony/Component/Notifier/Message/SmsMessage.php` to add the notification in order to be able to use the notification importance when creating options.
Commits
-------
bf594b75d0 Add Mobyt Notifier bridge
This PR was merged into the 5.2-dev branch.
Discussion
----------
[FrameworkBundle] Allow to leverage autoconfiguration for DataCollectors with template
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
When creating a datacollector with a template for the profiler display, an id must be set in the `data_collector` tag and must be the same as this returned by `DataCollectorInterface::getName`. A template path can also be added to the tag. We lose in this case the ability to use autoconfigure. This PR suggests:
- To guess the id configured in the `data_collector` tag. To follow the principle already used for services ids or events names, if not specified, the id is the data collector class name.
- To allow data collectors to provide the template path from the code. Note that the template path configuration via the `data_collector` tags still takes precedence over configuration from the code.
This PR also provides an `AbstractDataCollector` to avoid to implement methods that might be considered as boilerplate: `reset` and `getName`.
Commits
-------
986a0a221e [FrameworkBundle] Allow to leverage autoconfiguration for DataCollectors with template
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[Security] Add event to inspect authenticated token before it becomes effective
| 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.
This PR adds a new event, which is disapatched right after the authenticated token has been created by the authenticator, to "announce" it to the application *before* it becomes effective to the security system. The event works similar to `ResponseEvent`, but for security token. It allows listeners to inspect the new token before it becomes effective and - most importantly - apply modifications to it. So components other than the authenticator will be able to influence how the security token looks like, that will be set to the security layer on successful authentication.
Why would you want to do this? Of course I'm looking at this from the 2fa perspective. To make 2fa work, it's necessary to prevent a newly created authenticated token from becoming visible to the security system and therefore exposing its privileges/roles. This is done by replacing the authenticated token with a temporary "TwoFactorToken". Currently I'm doing this through dependency injection, getting all the registered authenticators and decorating them with my own token-exchange logic. This is not very clean and overly complicated, but it works. Adding this event as a hook-in point would allow for a much cleaner integration for any component that wants to have a saying in how the security token should look like.
Commits
-------
20309646b7 [Security] Add event to inspect authenticated token before it becomes effective
This PR was merged into the 5.2-dev branch.
Discussion
----------
[FrameworkBundle] Fix 7.4 CachePools integration tests
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | #36691 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | N/A
Attempt to fix https://github.com/symfony/symfony/runs/975252922#step:11:56 on master.
Commits
-------
d3ef8ba3bd [FrameworkBundle] Fix 7.4 CachePools integration tests
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Workflow] Added Context to Workflow Event
There's also a default context for the initial marking event.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#37421
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/13947
This time, I need context in the events, because, sometimes, the transition is automatic and sometimes, it is manual. I want to be able to make the difference. I figured using the context for that is a good idea. I hope you do too :)
By the way, I believe it also fixes#37421 . I took @pluk77 request to be able to differentiate an initial marking by having a default context in that case
Commits
-------
bfe07dda83 Added Context to Workflow Event There's also a default context for the initial marking event.
This PR was merged into the 3.4 branch.
Discussion
----------
Use PHPUnit 9.3 on php 8
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Part of #37564
| License | MIT
| Doc PR | N/A
Our CI for PHP 8 is currently a blind spot, mainly because the PHPUnit version 8.3 that we use for the test suite is incompatible with php 8. This PR changes the PHPUnit version used on Travis for php 8 to PHPUnit 9.3.
Our test suite might not be 100% compatible with that new PHPUnit release yet, but this change should allow us to run most tests on php 8 again and enable us to iteratively migrate to PHPUnit 9.3.
Commits
-------
d642d85cd3 Use PHPUnit 9.3 on php 8.
* 5.1:
Fix for issue #37681
Revert changes to Table->fillCells()
[Console] Table: support cells with newlines after a cell with colspan >= 2
Fix redis connect with empty password
[Validator] Add BC layer for notInRangeMessage when min and max are set
* 4.4:
Fix for issue #37681
Revert changes to Table->fillCells()
[Console] Table: support cells with newlines after a cell with colspan >= 2
Fix redis connect with empty password
[Validator] Add BC layer for notInRangeMessage when min and max are set
This PR was merged into the 4.4 branch.
Discussion
----------
[Validator] Add BC layer for notInRangeMessage when min and max are set
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#36133
| License | MIT
| Doc PR |
According to #36133, the improvement added in #32435 may lead to a BC break when the developer pass `min` and `max` options and a custom `minMessage` or `maxMessage`. In this case it's expected to receive a `minMessage`/`maxMessage` in the violation but a `notInRangeMessage` is received instead.
So in the following conditions:
- `min` and `max` options are set
- `minMessage` or `maxMessage` is set
A deprecation is triggered. If a limit is violated and matches to the min/max message passed as option (`minMessage` for `min` violated and `maxMessage` for `max` violated), `minMessage/maxMessage` is used in the violation instead of `notInRangeMessage`.
Commits
-------
092d85c947 [Validator] Add BC layer for notInRangeMessage when min and max are set
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Console] allow multiline responses to console questions
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | symfony/symfony-docs#14002
By default, the question helper stops reading user input when it receives a newline character (i.e., when the user hits `ENTER` once). However, with this feature, developers may specify that the response to a question should allow multiline answers by passing `true` to `setMultiline()`.
Multiline questions stop reading user input after receiving three newline characters in a row (i.e., the user hits `ENTER` three times) or an end-of-transmission control character (`Ctrl-D` on Unix systems or `Ctrl-Z` on Windows).
If a user enters a newline character without input, control is returned to the question class, where the input may be validated to prompt the user again (in the case of a required question), or control may be passed along to the rest of the script.
Commits
-------
0bf89cdf71 [Console] allow multiline responses to console questions
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
Fix for issue #37681
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37681
| License | MIT
| Doc PR |
Allow BOM character and comments before `<!DOCTYPE html>` declaration in DomCrawler while choosing a parser implementation
Commits
-------
9bc249e0b9 Fix for issue #37681
This PR was merged into the 4.4 branch.
Discussion
----------
[Console] Revert changes to Table->fillCells()
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
These changes were introduced in https://github.com/symfony/symfony/pull/37731 but no longer contributed to the actual fix, which was to perform a ->copyRow().
Commits
-------
17263ca14d Revert changes to Table->fillCells()
This PR was merged into the 5.2-dev branch.
Discussion
----------
[FrameworkBundle] do not use deprecated mailer.logger_message_listener service
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
0e93216322 do not use deprecated mailer.logger_message_listener service
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[Serializer] Add CompiledClassMetadataFactory
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ?
| License | MIT
| Doc PR | todo (issue: https://github.com/symfony/symfony-docs/issues/10706)
This introduce a dumped `ClassMetadataFactoryInterface` implementation to speed up the serializer by leveraging [PHP7 immutable array](https://blog.blackfire.io/php-7-performance-improvements-immutable-arrays.html).
Like for https://github.com/symfony/symfony/pull/28865, if the user have the opcache extension enabled, the compilation time will be skipped. The user will also have a performance boost when not using opcache as we are no longer fetching `ClassMetadata` from the PSR-6 cache.
This allow to speed up the normalization (without opcache) by 9-12% depending on how many objects are involved in the graph:
- [SymfonyObjectNormalizerBenchmark, 100 iterations with complexity of 1](https://blackfire.io/profiles/compare/d937a9cc-eebf-47eb-be90-c8e65cdf12b3/graph)
- [SymfonyObjectNormalizerBenchmark, 3 iterations with complexity of 60](https://blackfire.io/profiles/compare/d490542c-9a79-48a0-b7bc-1ed3ca6a9148/graph)
On the `FrameworkBundle` side, I suggest to add a `CacheWarmer` to dump the metadata array from configured class list. The list could have a _good_ default which will load the classes found in `src/Entity`.
## Dumping the `ClassMetadata`
```php
$classMetadatas = [];
foreach([Category::class, Comment::class, Forum::class, Thread::class, User::class] as $class) {
$classMetadatas[] = $this->classMetadataFactory->getMetadataFor($class);
}
file_put_contents('dumped.php', $this->classMetadataFactoryCompiler->compile($classMetadatas));
```
## Using the dumped `ClassMetadata`
```php
$classMetadataFactory = new CompiledClassMetadataFactory(
'dumped.php',
new CacheClassMetadataFactory(
new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())),
new ApcuAdapter('SymfonyMetadata')
)
);
```
# To do
- [x] Tests.
- [x] Cache warmer.
- [x] Documentation.
- [x] Changelog entry.
Commits
-------
63cbf0abe8 [Serializer] Add CompiledClassMetadataFactory
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Stopwatch] Add name property to the stopwatchEvent
| Q | A
| ------------- | ---
| Branch? | master for features
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#37627
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Commits
-------
f2b64ecc6a Add name property to the stopwatchEvent
This PR was squashed before being merged into the 3.4 branch.
Discussion
----------
[Yaml] Fix for #36624; Allow PHP constant as first key in block
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#36624
| License | MIT
| Doc PR |
When using a PHP constant in the first key of a mapping the parser would throw an exception. However if you used a PHP constant in any other key but the first it was allowed. This fix allows PHP constant as the first key.
I've included a test for this parser error along with the fix.
Commits
-------
46f635c492 [Yaml] Fix for #36624; Allow PHP constant as first key in block
This PR was merged into the 3.4 branch.
Discussion
----------
[Form] fix mapping errors from unmapped forms
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#10519
| License | MIT
| Doc PR |
Commits
-------
235920a388 fix mapping errors from unmapped forms
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Messenger] Add method HandlerFailedException::getNestedExceptionOfClass
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| License | MIT
| Doc PR | in progress
I have many times use this kind of code on my own development. It helps when dealing with specific exception through a Messenger usage.
Example in an ExceptionListener, the exception you get could be a `HandlerFailedException` but you want a specific treatment when the original exception is different (like a RedirectResponse, or Http error code different).
edit: I finally also added a getNestedExceptionOfClass that could be useful too
Commits
-------
e0dd84b426 [Messenger] Add method HandlerFailedException::getNestedExceptionOfClass
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Console] Table: support cells with newlines after a cell with colspan >= 2
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
When rendering a table with a cell containing newlines after a cell with
colspan set to at least 2, every line in the cell with newlines except the
first one fails to render.
This case is fixed by calling `->fillCells()` on the unmerged rows and
implementing support for rows that start with a non-zero index for the columns.
While fixing this, I discovered another issue with colspan: if a cell following a
colspanned cell contains enough newlines to make the contents extend further
than the colspanned cell's contents, the cells become misaligned. This is now
also fixed.
Commits
-------
ca11772e3f [Console] Table: support cells with newlines after a cell with colspan >= 2
This PR was merged into the 5.2-dev branch.
Discussion
----------
Revert "[DependencyInjection] Resolve parameters in tag arguments"
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | #35337
| License | MIT
| Doc PR | N/A
Revert of earlier PR, see discussion https://github.com/symfony/symfony/pull/37243
Commits
-------
9731451b5a Revert "[DependencyInjection] Resolve parameters in tag arguments"