* 5.0:
fix unix root dir issue
sync validator translation files with master
fix anchor
fix links to releases page (formerly known as "roadmap")
[Console] Don't load same-namespace alternatives on exact match found
[HttpKernel] Fix method name in doc comments
* 4.4:
fix unix root dir issue
sync validator translation files with master
[HttpFoundation] fix not sending Content-Type header for 204 responses
[ErrorHandler] silence warning when zend.assertions=-1
fix anchor
[Console] Handle zero row count in appendRow() for Table
fix links to releases page (formerly known as "roadmap")
[Console] Don't load same-namespace alternatives on exact match found
* 3.4:
fix unix root dir issue
sync validator translation files with master
fix anchor
fix links to releases page (formerly known as "roadmap")
[Console] Don't load same-namespace alternatives on exact match found
* 4.4:
[HttpFoundation] fix not sending Content-Type header for 204 responses
[ErrorHandler] silence warning when zend.assertions=-1
[Console] Handle zero row count in appendRow() for Table
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpFoundation] fix not sending Content-Type header for 204 responses
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| 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 |
`$headers->remove('Content-Type')` did not actually work because PHP sends the Content-Type header based on the https://www.php.net/manual/en/ini.core.php#ini.default-mimetype ini setting anyway (which defaults to html). So we need to disable this ini for empty responses.
Commits
-------
06f5a1113d [HttpFoundation] fix not sending Content-Type header for 204 responses
This PR was merged into the 3.4 branch.
Discussion
----------
fix anchor
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | none
| License | MIT
| Doc PR | none
This is a continuation of PR #35703 that was merged a bit too early.
It accepts suggestion made there and, moreover, fixes anchor link (that changed from old roadmap page)
Commits
-------
5825e3c58c fix anchor
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Console] Handle zero row count in appendRow() for Table
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | n/a
When a `Table` is created and rendered with no rows (headers only) and subsequently rows are added using `appendRow()`, the first call to `appendRow()` clears back one line too far., thus removing the last run
This is caused by `calculateRowCount()` not accounting for the fact that the footer separator is also the header separator when no rows are present.
This PR works around the issue by checking to ensure that at least 1 row exists before including the footer separator in the row count.
## Example
Command:
```php
<?php
namespace App\Command;
class TableTestCommand extends Command
{
// ...
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('My table');
$table = new Table($output->section());
$table->setHeaders(['Column', 'Another column']);
$table->render();
$table->appendRow(['Value', 'Another Value']);
$table->appendRow(['Value', 'Another Value']);
}
}
```
Before fix:
```
+--------+----------------+
| Column | Another column |
+--------+----------------+
| Value | Another Value |
| Value | Another Value |
+--------+----------------+
```
After fix:
```
My table
+--------+----------------+
| Column | Another column |
+--------+----------------+
| Value | Another Value |
| Value | Another Value |
+--------+----------------+
```
Commits
-------
9b382590ee [Console] Handle zero row count in appendRow() for Table
This PR was merged into the 3.4 branch.
Discussion
----------
[Console] Don't load same-namespace alternatives on exact match
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35479
| License | MIT
| Doc PR | -
<!--
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/roadmap):
- 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
-------
707c5bade0 [Console] Don't load same-namespace alternatives on exact match found
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Form] Added an AbstractChoiceLoader to simplify implementations and handle global optimizations
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | ~
| License | MIT
| Doc PR | ~
<!--
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/roadmap):
- 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.
-->
Taking over #33218 (taking over #30983)
The `ChoiceLoaderInterface` is not easy to understand/implement, while its goal is simple, lazy load an array of choices.
What may seem complicated is the how/what to optimize loading, we need to deal with a `$value` callback (which refers to the `choice_value` option allowing to transform a model choice to a unique string value that can be displayed/submitted).
We have now enough implementations in core to justify the need of an abstraction and provide a better DX in the process.
Before this PR we needed to implement 3 methods to create a loader:
- `loadChoiceList(?callable $value): ChoiceListInterface`
- `loadChoicesForValues(array $values, ?callable $value): array`
- `loadValuesForChoices(array $choices, ?callable $value): array`
and handle optimization, in each.
Now we only need to implement:
- `loadChoices(): iterable`
and optionnally:
- `doLoadChoicesForValues(array $values, ?callable $value): array`
if more optimization is needed to only load submitted values, (i.e the core intl loader prevents loading values that are the same as choices, and the doctrine one performs a `WHERE id IN ($ids)` query).
Commits
-------
1394df2dea [Form] Added an AbstractChoiceLoader to simplify implementations and handle global optimizations
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Console][QuestionHelper] Use String width() to properly move the cursor backwards
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | https://github.com/symfony/symfony/pull/35536#issuecomment-581343181
| License | MIT
| Doc PR | -
This bug can only be fixed on master since we need to require the String component. Once the component is required, we can iterate in the Console component to use it more where it is needed.
Commits
-------
67a1f55ce1 [Console][QuestionHelper] Use String width() to properly move the cursor backwards
* 5.0:
[HttpClient] fix "undefined variable"
[HttpClient] remove useless code in test
[HttpClient] fix getting response content after its destructor throwed an HttpExceptionInterface
[HttpClient] fix HttpClientDataCollector when handling canceled responses
[Security] Fix exception name in doc comments
* 4.4:
[HttpClient] fix "undefined variable"
[HttpClient] remove useless code in test
[HttpClient] fix getting response content after its destructor throwed an HttpExceptionInterface
[HttpClient] fix HttpClientDataCollector when handling canceled responses
[Security] Fix exception name in doc comments
This PR was squashed before being merged into the 5.1-dev branch.
Discussion
----------
[Notifier] add OvhCloud bridge
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | See #33687
| License | MIT
This would add OvhCloud sms integration for the Notifier component.
Tested with 'ovh-eu' entrypoint.
Inspiration : https://github.com/ovh/php-ovh
Commits
-------
76bfb85e26 [Notifier] add OvhCloud bridge
This PR was merged into the 5.1-dev branch.
Discussion
----------
[PhpUnitBridge] Add the ability to expect a deprecation inside a test
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | todo
Replaces https://github.com/symfony/symfony/pull/25757
Proposed implementation uses a dedicated trait for a better DX. Using `$this->expectDeprecation()` feels natural.
Unfortunately it is not currently possible to test the cases that should produce errors or risky, so there are some things that are not testable here. I plan to propose another feature for the PhpUnitBridge to be able to test those kind of things. If it's accepted, we will then be able to strenghten the tests of this one.
Commits
-------
a3a928050d [PhpUnitBridge] Add the ability to expect a deprecation inside a test
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Contracts] Split the global CHANGELOG in dedicated CHANGELOG per contract
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
---
This is more in sync with what we do with other components + bundles.
And when we contribute to a contact, it's easier to find the file (because with the substree, we don't get the global package)
Commits
-------
a05ee087a2 [Constracts] Split the global CHANGELOG in dedicated CHANGELOG per contract
This PR was squashed before being merged into the 5.1-dev branch.
Discussion
----------
[Console] Moved estimated & remaining calculation logic to separate get method
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
This way, we can use `getEstimated()`and `getRemaining()` to get easy access to the estimated / remaining number of seconds to be used in our placeholder definition set with `setPlaceholderFormatterDefinition` without having to redefine the calculation ourself.
Example before;
```php
ProgressBar::setPlaceholderFormatterDefinition(
'eta',
function (ProgressBar $progressBar) {
$estimated = round((time() - $progressBar->getStartTime()) / ($progressBar->getProgress() ?: 0.1) * $progressBar->getMaxSteps());
return date('H:i:s', strtotime('+' . $estimated . ' seconds'));
}
);
```
Example after;
```php
ProgressBar::setPlaceholderFormatterDefinition(
'eta',
function (ProgressBar $progressBar) {
return date('H:i:s', strtotime('+' . $this->getEstimated() . ' seconds'));
}
);
```
Commits
-------
19958fba5a [Console] Moved estimated & remaining calculation logic to separate get method
This PR was squashed before being merged into the 5.1-dev branch (closes#33968).
Discussion
----------
[Notifier] Add Firebase bridge
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | See #33687
| License | MIT
This would add [Firebase](https://firebase.google.com) integration for the Notifier component. With Firebase you can send push notifications to the users of you Android and iOS app and website (formerly known as Google Cloud messaging).
I'm not sure if it's possible to have this merged, like the other bridges. Or if I should create a stand-alone repository? That'd be fine too.
Also it's now using the `ChatMessage` as implementation of `Symfony\Component\Notifier\Message\MessageInterface`, but I feel like this component could use a `PushMessage` or something similar. Although I'm not sure if it would contain more than `subject` that the `ChatMessage` does.
Commits
-------
2776d2f811 [Notifier] Add Firebase bridge
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Messenger] Add SQS transport
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | TODO
This PR add the AWS SQS transport in messenger.
It also add a `DisconnectedReceiverInterface` that allows the worker to release not-proceeded message (which are not automatically released in SQS and have to wait a TTL). Tell me if you prefer to move it in a dedicated PR.
accepted DNS:
- `sqs://default/accountId/queueName`
- `sqs://default/queueName`
- `sqs://default/queueName?region=us-east-2`
- `sqs://my_custome_endpoint:12345/queueName?sslmode=disabled`
To reduce AWS costs, the implementation performs a long polling call and prefetch several messages.
TO get ~real time worker, one could use `./bin/console messenger:consume --sleep 0.001`
Commits
-------
c226479d5f [Messenger] Add SQS transport
This PR was merged into the 5.1-dev branch.
Discussion
----------
[RFC][DX][OptionsResolver] Allow setting info message per option
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | TODO
This is a DX proposal that will help in debugging/errors to better understand the meaning of one defined option.
This is how you'd use it:
```php
$resolver = new OptionsResolver();
$resolver->setDefined('date');
$resolver->setAllowedTypes('date', \DateTime::class);
$resolver->setInfo('date', 'A future date'); // <-- NEW
// ...
```
This information may be useful for those options where their name cannot be intuitive enough, or their purpose is too complex. Here is an example (based on the example above):
```php
// ...
$resolver->setAllowedValues('date', static function ($value): bool {
return $value >= new \DateTime('now');
});
```
So, if you introduce a date value that does not match the criteria, you will get this error message:
**Before:**
```
The option "date" with value DateTime is invalid.
```
Note that the allowed value is not printable in this case, hence the error message cannot be clear at all.
**After:**
```
The option "date" with value DateTime is invalid. Info: A future date.
```
Although a more accurate error message can be triggered within the `\Closure` if desired.
Also you'll see this info message on `debug:form` command (see tests), then you have in advance the informative description of any option.
What do you think?
Commits
-------
0477a06d8a Allow setting one info message per option
This PR was squashed before being merged into the 3.4 branch (closes#35657).
Discussion
----------
[Security] Fix exception name in doc comments
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Commits
-------
f10098e9f1 [Security] Fix exception name in doc comments
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Translation] Support name attribute on the xliff2 translator loader
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#32048
| License | MIT
| Doc PR | not done yet
Support using the `name` attribute on the `unit` element in xliff 2.0 to use as the "translation key" rather than always relying on the `<source>` content, as was done on the xliff 1.2.
Commits
-------
37b31149c6 Support name attribute on the xliff2 translator loader
* 5.0:
Add missing symfony/mime to require-dev
[Validator] Added the missing Mongolian translations
[ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
refactor(Process): fromShellCommandLine
[Mailer] Do not ping the SMTP server before sending every message
* 4.4:
Add missing symfony/mime to require-dev
[Validator] Added the missing Mongolian translations
[ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
refactor(Process): fromShellCommandLine
[Mailer] Do not ping the SMTP server before sending every message
This PR was merged into the 5.1-dev branch.
Discussion
----------
[MonologBridge] Add Mailer handler
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #33209 <!-- #-prefixed issue number(s), if any -->
| 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/roadmap):
- 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 4.4.
- Legacy code removals go to the master branch.
-->
Commits
-------
5b7393b823 Add monolog mailer handler
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Messenger] Add receiving of old pending messages (redis)
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/12976
This PR makes it possible for the redis transport to get abandoned messages from not running/idle consumers by using `XPENDING` and `XCLAIM`.
Usually it would be best to let the claiming of pending messages be handled by a separate command. Since the messenger component's commands are fixed, we do need to set a `claimTimeout`. The `claimTimeout` defines how long an idle message should be left alone until it will get claimed by the current consumer (Must be a value higher than the longest running handling time of a message or else the message will be handled twice).
Using this solution makes the remarks (https://github.com/symfony/symfony-docs/pull/11869#pullrequestreview-257483666) regarding not being able to use the hostname as consumer name obsolete. I would even recommend the hostname as the consumer name.
**Questions**
- [x] Which value should we use as default `claimTimeout`?
- [x] How should the `claimTimeout` be configured?
- [x] Feature or Bugfix?
I will create a docs PR and a PR for the other branches as soon as the questions are resolved.
Commits
-------
9cb6fdfabb Implemted receiving of old pending messages
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Validator] Add a constraint to sequentially validate a set of constraints
| 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 | N/A <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | Todo
Follows https://github.com/symfony/symfony/issues/20017#issuecomment-331276007 given some feedbacks about the suggested feature.
```php
/**
* @var string
*
* @Assert\Sequentially({
* @Assert\Type("string"),
* @Assert\Length(min="4"),
* @Assert\Regex("[a-z]"),
* @SomeCustomConstraintWithHeavyExternalCalls(),
* })
*/
public $foo;
```
This new `Sequentially` constraint solves - with less power but better DX - some of the use-cases of the `GroupSequence` feature, allowing to interrupt the validation of some constraints if a previous one in the list failed before. Constraints are validated in given order, and the first violation raised will prevent other constraint validators to be executed.
It can either prevent unexpected type exceptions thrown by further constraints or heavy & unnecessary calls to a database or external services if the value to validate already doesn't match some of the basic requirements.
Commits
-------
dfd9038d28 [Validator] Add a constraint to sequentially validate a set of constraints
This PR was squashed before being merged into the 5.1-dev branch (closes#34334).
Discussion
----------
[Validator] Allow to define a reusable set of constraints
| Q | A
| ------------- | ---
| Branch? | 5.1 <!-- 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 | N/A <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | TODO
The goal of this feature is to simplify writing a set of validation constraints to be reused consistently across the application. Which is especially useful with DTOs, as a same set of constraints can be used in different places.
For instance, given multiple DTOs containing the new user password in for different use-cases (register, forgot pwd, change pwd), the same rules apply on the property. Hence with this PR, you can write a single constraint class to be reused:
```php
/**
* @Annotation
*/
class MatchesPasswordRequirements extends Compound
{
protected function getConstraints(array $options): array
{
return [
new NotBlank(),
new Type('string'),
new Length(['min' => 12]),
new NotCompromisedPassword(),
];
}
}
```
I'm open to better naming and ways to expose the options to the `Compound::getConstraints` method, so options can be forwarded to the nested constraints for most specific use-cases.
Commits
-------
8f1b0dfdb7 [Validator] Allow to define a reusable set of constraints
This PR was merged into the 4.4 branch.
Discussion
----------
[Process] throw when PhpProcess::fromShellCommandLine() is used
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35637
| License | MIT
| Doc PR | None
Close#35638
Final PR (rebased and tests added)
Commits
-------
7f6d71c2a3 refactor(Process): fromShellCommandLine
This PR was merged into the 5.1-dev branch.
Discussion
----------
[HttpFoundation] Make dependency on Mime component optional
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Make the Mime component dependency optional
/cc @nicolas-grekas
Commits
-------
11cef32ff7 [HttpFoundation] Make dependency on Mime component optional
This PR was merged into the 4.4 branch.
Discussion
----------
[ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Because we don't use `assert()`, this is something we completely overlooked, but warnings triggered should not throw as there is already a dedicated exception mode when using `assert()`.
This turns this exception mode to 1 in debug mode and logs the assert() warnings in prod.
Commits
-------
f18ef6ca08 [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
This PR was merged into the 5.1-dev branch.
Discussion
----------
[HttpKernel] Make ErrorListener unaware of the event dispatcher
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
Under certain circumstances, HttpKernel's `ErrorListener` class might dynamically register and unregister a listener with the dispatcher. If our goal is to make the dispatcher immutable, that specific behavior would be in our way. Also, #34988 would break this workflow.
This PR provides an alternative. The listener is always registered, but I'm using the request to piggyback a flag that activates/deactivates the listener.
Commits
-------
a9d1dede44 [HttpKernel] Make ErrorListener unaware of the event dispatcher.
This PR was squashed before being merged into the 4.4 branch (closes#35633).
Discussion
----------
[Mailer] Do not ping the SMTP server before sending every message
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35515
| License | MIT
This pull request changes the SMTP transport to only ping the server if the last message was sent more than a specified number of seconds ago (instead of pinging the server before every message). By default, it will ping the server if 100 or more seconds since the last message have passed.
This should make sending emails with the SMTP transport more robust with many emails, as SMTP servers will often drop the connection if too many non-mail commands are sent (like pinging the server with NOOP commands).
Commits
-------
28178108d3 [Mailer] Do not ping the SMTP server before sending every message
Optimise various methods and conditions to use best
performing alternatives where possible. Roughly:
* Uses methods that do not copy memory, e.g. strncmp
as alternative for strpos matching beginning of string.
* Switches order of some conditions to put the cheapest
checks first in order.
* Checks input before calling trim() - despite the function
returning the same string as input, it still costs memory
and introduces unnecessary overhead.
* Extracts variables for repeated identical function calls.
* Uses negative substring offsets instead of strlen + substr.
* Replaces single-char substr usages with substring access.
* 5.0:
[FrameworkBundle] fix "samesite" in XSD
[Console] Consider STDIN interactive
Update UserPasswordEncoderCommand.php
[HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
[DoctrineBridge] Fixed submitting ids with query limit or offset
* 4.4:
[FrameworkBundle] fix "samesite" in XSD
[Console] Consider STDIN interactive
Update UserPasswordEncoderCommand.php
[HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
[DoctrineBridge] Fixed submitting ids with query limit or offset
* 3.4:
[FrameworkBundle] fix "samesite" in XSD
Update UserPasswordEncoderCommand.php
[HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
[DoctrineBridge] Fixed submitting ids with query limit or offset
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Cache] add SodiumMarshaller
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Add `SodiumMarshaller` to encrypt cache values
To use the `SodiumMarshaller` we can decorate the `cache.default_marshaller`:
```yaml
Symfony\Component\Cache\Marshaller\SodiumMarshaller:
decorates: cache.default_marshaller
arguments:
- ['%env(CACHE_DECRYPTION_KEY)%', '%env(OLD_CACHE_DECRYPTION_KEY)%']
- '@Symfony\Component\Cache\Marshaller\SodiumMarshaller.inner'
```
The first provided key is used to encrypt and decrypt cached values.
In order to allow rotating keys, more keys can be provided - they will be used only to decrypt values.
/cc @nicolas-grekas
Commits
-------
540d7eb174 [Cache] add SodiumMarshaller
This PR was merged into the 3.4 branch.
Discussion
----------
[HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35520
| License | MIT
| Doc PR | -
This PR cherry-picks #28168 on 3.4, with a rationale given by @ConneXNL in https://github.com/symfony/symfony/issues/35520#issuecomment-582296847:
> I hope I am wrong but I see the impact of not making any changes to Symfony 3.4 will have a tons of sites break if we cannot set the cookie's samesite setting (in the framework session and remember me) before Chrome pushes this update.
>
> Very soon all existing cookies are no longer going to work with cross-domains if you do not specify 'None' for the cookie_samesite. All external APIs that use cookies and are running SF 3.4 will break and devs will have no quick solution to fix their auth process.
>
> If you are using PHP 7.4, yes you can most likely use ini_set to workaround this issue.
>
> However, ini_set('cookie_samesite') does not work in PHP Version <= 7.2.
I am not even sure PHP 7.3 supports the value 'None' as php.watch/articles/PHP-Samesite-cookies says it has support for 'Lax' and 'Scrict'.
>
> This effectively means SF 3.4 on PHP 7.2 (or PHP 7.3) is no longer supported for cross domain APIs with cookies. People would have to either update PHP to 7.4 (if they even can?) or go to Symfony 4 (with a dead live site is going to be a complete disaster).
>
> Since the impact of the change that chrome is about to roll out is so fundamentally changing our way to set cookies, I consider configuring samesite configuration in the framework an absolute requirement, not a feature, especially since SF 3.4 is still supported.
>
> What am i missing?
>
> Note: SF3 HTTPFoundation already supports the new cookie settings, it's just the framework that doesn't support it.
Our BC policy embeds the promise that one should be able to keep the same app on a newest infrastructure (eg that's why supporting a PHP version is a bug fix). I think we can consider this for browsers here also. WDYT?
Commits
-------
f46e6cb8a0 [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
This PR was merged into the 3.4 branch.
Discussion
----------
[DoctrineBridge] Fixed submitting ids with query limit or offset
| Q | A
| ------------- | ---
| Branch? | 3.4
| 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 https://github.com/symfony/symfony/pull/34900#discussion_r375246113 <!-- prefix each issue number with "Fix #", if any -->
| 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/roadmap):
- 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
-------
9bb194098f [DoctrineBridge] Fixed submitting ids with query limit or offset
This PR was merged into the 5.1-dev branch.
Discussion
----------
[String] Remove the @experimental status
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | https://github.com/symfony/symfony/pull/35578#discussion_r375955786
| License | MIT
| Doc PR | -
Commits
-------
3d15f91723 [String] Remove the @experimental status
This PR was merged into the 5.1-dev branch.
Discussion
----------
[DI] added possibility to define services with abstract arguments
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#31769
| License | MIT
| Doc PR | n/a
feature caused by rfc #31769 from issues list
I hope, this PR will be useful
Abstract argument have to replaced by one of compiler passes or exception will be thrown.
Example:
This service definition
```xml
...
<service id="App\Test\Test">
<argument key="$a" type="abstract">should be defined by TestPass</argument>
</service>
...
```
or this for yaml
```yaml
App\Test\Test:
arguments:
$a: !abstract should be defined by TestPass
```
causes exception like `Argument "$a" of service "App\Test\Test" is abstract (should be defined by TestPass), did you forget to define it?`
if argument was not replaced by compiler pass
```php
...
public function process(ContainerBuilder $container)
{
$test = $container->getDefinition(Test::class);
$test->setArgument('$a', 'test');
}
...
```
Commits
-------
62fefaa59f [DI] added possibility to define services with abstract arguments
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Routing] add priority option to annotated routes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | yes
| Tickets | Fix #26132
| License | MIT
| Doc PR | -
This PR allows defining the priority of routes using annotations:
`@Route(name="foo", priority=10)`
As requested [in this comment](https://github.com/symfony/symfony/pull/26132#pullrequestreview-352321332), priority is reserved to using annotations. For other formats, the order works fine.
Commits
-------
8522a83217 [Routing] add priority option to annotated routes
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This PR results from a discussion we had yesterday with @alcaeus, @beberlei and others at the Symfony UG meetup in Berlin (thanks SensioLabs for bringing me there).
It provides a generic function and convention to trigger deprecation notices, which could be a better alternative to the `@trigger_error(..., E_USER_DEPRECATED)` calls that we use currently.
This proposed package would provide a single global function named `deprecated()`.
Its purpose is to trigger deprecations in a way that can be silenced on production environment
by using the `zend.assertions` ini setting and that can be caught during development to generate reports.
The function requires at least 3 arguments:
- the name of the package that is triggering the deprecation
- the version of the package that introduced the deprecation
- the message of the deprecation
- more arguments can be provided: they will be inserted in the message using `printf()` formatting
Example:
```php
deprecated('symfony/blockchain', 8.9, 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin');
```
This will generate the following message:
`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.`
Check #35550 to see how using this function could look like on Symfony itself.
Commits
-------
f0f41cbfc5 [Contracts/Deprecation] Provide a generic function and convention to trigger deprecation notices
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Form] Add "is empty callback" to form config
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/31572 for 4.4+
| License | MIT
| Doc PR | -
This PR introduces a new feature that allow to resolve a bug.
Currently, the `isEmpty()` behavior of the `Form` class is the same whatever its configuration. That prevents us to specify a different behavior by form type.
But I think that some form types should have dedicated empty values. For example, the `CheckboxType` model data either resolves to `true` (checked) or `false` (unchecked). But `false` is not an empty value in the `Form::isEmpty()` method, so a `CheckboxType` form can never be empty. `false` should not be in that list because for other form types, it's perfectly fine that it's not considered as an empty value.
The problem is better seen in https://github.com/symfony/symfony/issues/31572 with a `ChoiceType` that is never considered as empty (when no radio button is checked).
Being able to specify the "is empty" behavior by form type would also allow users to define their own logic in their custom form types + probably define it ourselves in all our form types in order to get rid of the default common behavior.
Commits
-------
7bfc27e7cf [Form] Add "is empty callback" to form config
This PR was merged into the 5.1-dev branch.
Discussion
----------
[DI] Enable auto alias compiler pass by default
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? |
| Deprecations? | no
| Tickets | Fix#34194
| License | MIT
| Doc PR |
I'm sending this PR to trigger a discussion as @nicolas-grekas suggested in #34194
I'm using this quite a lot in one of my applications and I don't see any reasons why it shouldn't be enabled by default.
Commits
-------
4fde51745b Enable auto alias compiler pass by default
* 5.0:
[Mailer] fix typos
[Messenger] fix typo
[DI] Unknown env prefix not regornized as such
[DI] Fix support for multiple tags for locators and iterators
[PhpUnitBridge] Fix some errors when using serialized deprecations
Fix HTTP client config handling
* 4.4:
[Mailer] fix typos
[Messenger] fix typo
[DI] Unknown env prefix not regornized as such
[DI] Fix support for multiple tags for locators and iterators
[PhpUnitBridge] Fix some errors when using serialized deprecations
Fix HTTP client config handling
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Validator] add Validation::createCallable()
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
This is an initial PR to check/discuss the implementation of a callable validator.
If there is interest in merging this, I will gladly update the docs and such.
The use case is mainly for validation of console questions, since the default validation has been removed in the latest version and i could not find an easy solution to replace it (if there already is some solution for this, i'm not aware of it) and the question helper uses callables.
This small class allows the standard symfony validators to be used in console questions, or any other location that requires a callable validator.
Example use case:
```php
$io = new SymfonyStyle($input, $output);
$required = new CallableValidator([new NotBlank()]);
$wsdl = $io->ask('Wsdl location (URL or path to file)', null, $required);
```
As said before, this is by no means the final version, but I would like to know if there is interest in merging this (and receive some feedback about the implementation) before I put any more effort into this.
Commits
-------
2e4f2ac322 [Validator] add Validation::createCallable()
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Notifier] Added possibility to extract path from provided DSN
| 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#34746
| License | MIT
I'm currently working on Microsoft Teams Webhook Notifier (https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook), and there is no way to provide DSN for it, because of missing parse_url()['path'] option
It looks like
`teams://outlook.office.com/webhook/{uuid}@{uuid}/IncomingWebhook/{id}/{uuid}`
and I'd like to be able to build Notifier Transport endpoint from it
Commits
-------
ab9b49b5c6 [Notifier] Added possibility to extract path from provided DSN
This PR was merged into the 5.1-dev branch.
Discussion
----------
[FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase
| Q | A
| ------------- | ---
| Branch? | 4.4+
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#35510
| License | MIT
| Doc PR |
Since 4.4, we have new PHPUnit constraints for the mailer component, but these are only available with `WebTestCase` and not `KernelTestCase`. I think this would be useful to access these constraints from both TestCase.
I don't know if I should move these [tests](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php) or add new ones only for `KernelTestCase`?
Commits
-------
1b1ab2991a [FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase
This PR was merged into the 5.1-dev branch.
Discussion
----------
[FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
No need to configure the same requirements for `_locale` in all routes any more thanks to the `framework.translator.enabled_locales` config option introduced in #32433.
Commits
-------
5eebd37625 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Notifier] Remove superfluous parameters in *Message::fromNotification()
| Q | A
| ------------- | ---
| Branch? | 5.0
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Those classes are final so I think we don't need those extra arguments.
Commits
-------
d0dacf51e1 [Notifier] Remove superfluous parameters in *Message::fromNotification()
This PR was squashed before being merged into the 5.1-dev branch (closes#35485).
Discussion
----------
[Messenger] Add support for PostgreSQL LISTEN/NOTIFY
| 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 | n/a
| License | MIT
| Doc PR | todo
PostgreSQL comes with a builtin, performant, scalable and transactional pub/sub system called [`LISTEN`/`NOTIFY`](https://www.postgresql.org/docs/current/sql-notify.html).
This PR allows to leverage this mechanism when using the Messenger component with Postgres.
When the Postgres is used, workers are notified in real-time when a message is dispatched.
This reduces the latency, and prevents the worker from executing useless SQL queries. Basically, it allows to switch from a polling-based approach to an event-based one.
This patch can be used with all existing installation of Messenger, as long as the underlying DBMS is Postgres. For many (most ?) projects, it allows to get the benefits of using a queue system such as RabbitMQ or Pulsar without having to introduce new services to monitor, replicate or upgrade.
If PostgreSQL is used, `LISTEN`/`NOTIFY` is used automatically!
That's all!
It's also possible to configure how long the worker must wait for new messages:
```yaml
framework:
messenger:
transports:
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
pgsql_get_notify: true
pgsql_get_notify_timeout: 500
```
Then you can use start the workers with something like: `php bin/console messenger:consume --sleep=0`
A demo app using this new feature is available in this repository: https://github.com/dunglas/demo-postgres-listen-notify
TODO:
* [ ] Add tests
Commits
-------
01f33c3ab5 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY
This PR was merged into the 4.4 branch.
Discussion
----------
Fix HTTP client config handling
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Defining a `key` parameter in the `query` option of a scoped HTTP client triggers an error:
```
Undefined index: value
```
This PR fixes this issue but an edge case still remains with YAML and PHP config. If one wants to define parameters `key=foo`, `value=bar` and nothing else, the query will actually be `foo=bar` instead of `key=foo&value=bar`. Not sure how to fix this case without breaking the tests I added here.
Commits
-------
963d0cce86 Fix HTTP client config handling
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Mailer] Fix MandrillHttpTransport::getRecipients()'s call
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Should make the CI green.
Commits
-------
f88d1bb328 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Cache] Add couchbase cache adapter
| Q | A
| ------------- | ---
| Branch? | 4.4 for features
| Bug fix? | no
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/32038
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/11748
Add new cache adapter to be able using Couchbase as cache system.
Commits
-------
1ae7dd5ec7 [Cache] Add couchbase cache adapter
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Translation] Introduce a way to configure the enabled locales
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #31563
| License | MIT
| Doc PR | -
This implements the idea #31563 so we can decide if we want to add this or not. I tested it in the "Symfony Demo" app. Before: 107 catalogs created in cache/dev/translations/. After: 43 catalogs. But that's because the app is translated into lots of languages. In most cases, only 2 catalog files will be generated (vs 107 before).
If this idea is approved, I'll add tests and docs. Thanks.
Commits
-------
765843426e [Translation] Introduce a way to configure the enabled locales
This PR was merged into the 5.1-dev branch.
Discussion
----------
[VarDumper] Add a RdKafka caster
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
Hello,
This is the very beginning of this new feature.
First, I'd like to know if there's a no-go for this feature so I won't waste my time.
Then, if you are a RdKafka expert, I'd take your comments with much pleasure sincer I'm a noob in this technology (and that's why I'm implementing this caster 🤓)
Tests need to be added once the implementation will be a bit more complete.
Commits
-------
6cd1235539 Add a RdKafka caster to Var-Dumper
* 5.0:
Add missing use statements
[Translation] Add missing use statement
[Translation] Add missing use statement
[Config][XmlReferenceDumper] Prevent potential \TypeError
[Mailer] Fix broken mandrill http send for recipients with names
[Translation] prefer intl domain when adding messages to catalogue
Fix CS
Fix CS
Fail on empty password verification (without warning on any implementation)
[Translation][Debug] Add installation and minimal example to README
[Validator] try to call __get method if property is uninitialized
Show both missing packages in the same error message
Fix handling of empty_data's \Closure value in Date/Time form types
* 4.4:
Add missing use statements
[Translation] Add missing use statement
[Translation] Add missing use statement
[Config][XmlReferenceDumper] Prevent potential \TypeError
[Mailer] Fix broken mandrill http send for recipients with names
[Translation] prefer intl domain when adding messages to catalogue
Fix CS
Fix CS
Fail on empty password verification (without warning on any implementation)
[Translation][Debug] Add installation and minimal example to README
[Validator] try to call __get method if property is uninitialized
Show both missing packages in the same error message
Fix handling of empty_data's \Closure value in Date/Time form types
* 3.4:
[Translation] Add missing use statement
[Translation][Debug] Add installation and minimal example to README
[Validator] try to call __get method if property is uninitialized
Fix handling of empty_data's \Closure value in Date/Time form types
This PR was merged into the 3.4 branch.
Discussion
----------
[Form] Fix handling of empty_data's \Closure value in Date/Time form types
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#33188
| License | MIT
| Doc PR | -
Basically this would solve the posibility to pass a `\Closure` to the `empty_data` option for Date/Time form types.
> https://symfony.com/doc/current/reference/forms/types/form.html#empty-data
> If a form is compound, you can set empty_data as an array, object or **closure**. See the [How to Configure empty Data](https://symfony.com/doc/current/form/use_empty_data.html) for a Form Class article for more details about these options.
Also related to https://github.com/symfony/symfony/pull/29182
Commits
-------
4939f0e323 Fix handling of empty_data's \Closure value in Date/Time form types
This PR was squashed before being merged into the 4.4 branch (closes#35430).
Discussion
----------
[Translation] prefer intl domain when adding messages to catalogue
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
This PR ensures that when adding translations to a catalogue using the `add(array $messages, string $domain = 'messages')` method internally the intl icu domain is checked first.
Otherwise it could happen that existing messages in e.g. `messages+intl-icu` are not updated but the same keys are added to `messages`.
This is a follow-up of #35370, now targeting the `4.4` branch.
Commits
-------
b72b7d3413 [Translation] prefer intl domain when adding messages to catalogue
This PR was merged into the 4.4 branch.
Discussion
----------
[DX][TwigBridge] Show both missing packages for NotificationMail in the same error message
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | n/a
I ran `composer req twig` expecting to be ready to use the notification mail feature. After that, it required 2 page refreshes in the browser and 2 composer commands to be ready. This PR merges both missing packages into one error message, to improve developer experience.
Commits
-------
f462285381 Show both missing packages in the same error message
This PR was merged into the 5.1-dev branch.
Discussion
----------
[HttpClient] adding NoPrivateNetworkHttpClient decorator
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
The purpose of NoPrivateNetworkHttpClient is for block requests to private networks by default or block one or more subnetwork if specified. NoPrivateNetworkHttpClient accepts two arguments, first one is a HttpClientInterface instance and subnetworks as a second argument.
Second argument $subnets can be null for blocking requests to private networks, or string to specify a single subnet of array for a set of subnets.
```php
<?php
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\NoPrivateNetworkHttpClient;
$client = new NoPrivateNetworkHttpClient(HttpClient::create());
// You can request public networks normally using the code above
$client->request('GET', 'https://symfony.com/');
// Requests to private neworks will be blocked because second argument ($subnets) is null
$client->request('GET', 'http://localhost/');
// If we request from 104.26.14.0 to 104.26.15.255 we'll get an exception, since I'm specifying a subnetwork
$client = new NoPrivateNetworkHttpClient(HttpClient::create(), ['104.26.14.0/23']);
// Let's suppose that our DNS server resolves symfony.com to 104.26.14.6, then the following request will be blocked
$client->request('GET', 'https://symfony.com/');
```
Commits
-------
63fec805f4 [HttpClient] adding NoPrivateNetworkHttpClient decorator
This PR was merged into the 5.1-dev branch.
Discussion
----------
[HttpKernel] allow using public aliases to reference controllers
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This PR allows referencing a controller with an alias when needed. The use case I'm targetting is using `@Route` annotations on methods of the `App\Kernel` and have them work. This PR allows it.
Sidekick of https://github.com/symfony/recipes/pull/735
Commits
-------
94bc1f7d3b [HttpKernel] allow using public aliases to reference controllers
This PR was squashed before being merged into the 5.1-dev branch.
Discussion
----------
[HttpClient] make response stream functionality consistent
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | n/a
There are three ways of creating a stream from a response:
1. Calling `$response->toStream()` (if the response supports this)
2. Calling `StreamWrapper::createResource($response)`
3. Calling `StreamWrapper::createResource($response, $httpClient)` (note the second argument)
Currently, the 3rd method creates a stream that is not rewindable (the other two are). The first commit adds tests showing the inconsistencies (1 test fails). The second commit is a fix to make the 3 ways consistent.
See https://twitter.com/nicolasgrekas/status/1224047079422599168 for reference.
Commits
-------
64f9111686 [HttpClient] make response stream functionality consistent
This PR was squashed before being merged into the 3.4 branch (closes#35552).
Discussion
----------
[Translation][Debug] Add installation and minimal example to README
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | -
At SymfonyCon, we decided to test out removing some component documentation from the official docs. These were duplicating quite some information of the main guides and were confusing people that used the components in the framework.
I think it's good to reintroduced the composer installation command and a very minimal example in the README's of the component. This doesn't require maintenance and can kickstart people to gain knowledge on how to use the component.
For now, we've (re)moved the Debug and Translation component docs, so that's why I've only modified those README's.
cc @symfony/team-symfony-docs
Commits
-------
b52b7b9fd6 [Translation][Debug] Add installation and minimal example to README
* 5.0:
[Phpunit] Fix running skipped tests expecting only deprecations
Fix merge
[Config] dont catch instances of Error
[HttpClient] fix HttpClientDataCollector when handling canceled responses
[FrameworkBundle] remove mention of the old Controller class
[DependencyInjection] #35505 Fix typo in test name
[Yaml][Inline] Fail properly on empty object tag and empty const tag
Check non-null type for numeric type
Check value isset to avoid PHP notice
bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
* 4.4:
[Phpunit] Fix running skipped tests expecting only deprecations
Fix merge
[Config] dont catch instances of Error
[HttpClient] fix HttpClientDataCollector when handling canceled responses
[DependencyInjection] #35505 Fix typo in test name
[Yaml][Inline] Fail properly on empty object tag and empty const tag
Check non-null type for numeric type
Check value isset to avoid PHP notice
bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
This PR was merged into the 3.4 branch.
Discussion
----------
[Validator] check for __get method existence if property is uninitialized
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35544
| License | MIT
Resolve bug #35544.
On PHP 7.4, check if object implements `__get` magic method if property is reported as uninitialized before returning null.
Commits
-------
427bc3aa18 [Validator] try to call __get method if property is uninitialized
* 3.4:
[Phpunit] Fix running skipped tests expecting only deprecations
[DependencyInjection] #35505 Fix typo in test name
[Yaml][Inline] Fail properly on empty object tag and empty const tag
Check non-null type for numeric type
Check value isset to avoid PHP notice
bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
This PR was merged into the 3.4 branch.
Discussion
----------
[DependencyInjection] Fix typo in test name
Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer.
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes (technically)
| New feature? | no
| Deprecations? | no
| Tickets | #35505
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Commits
-------
9cbfad5853 [DependencyInjection] #35505 Fix typo in test name
This PR was merged into the 3.4 branch.
Discussion
----------
[Yaml][Inline] Fail properly on empty object tag and empty const tag
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Rework of https://github.com/symfony/symfony/pull/35208 to not end up in `parseScalar` with an empty string or a boolean (and thus, avoid unfriendly error such as `Trying to access array offset on value of type bool`).
Ping @xabbuh
Commits
-------
bdf02c0a7e [Yaml][Inline] Fail properly on empty object tag and empty const tag
This PR was merged into the 3.4 branch.
Discussion
----------
[PhpUnitBridge] Fix running skipped tests expecting only deprecations
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
If a test class has unsatisfied `@requires` and contains test methods expecting deprecation only, you get:
> Fatal error: Uncaught Error: Call to a member function beStrictAboutTestsThatDoNotTestAnything() on null in ./symfony/symfony-dev/vendor/symfony/phpunit-bridge/Legacy/SymfonyTestsListenerTrait.php:229
Spotted in #34925's build.
Commits
-------
6b02362c5b [Phpunit] Fix running skipped tests expecting only deprecations
This PR was merged into the 3.4 branch.
Discussion
----------
[FrameworkBundle] Check non-null type for numeric type
$maxAge and $sharedAge can both be zero
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| License | MIT
Commits
-------
2797867ae9 Check non-null type for numeric type
This PR was merged into the 3.4 branch.
Discussion
----------
[DomCrawler] Skip disabled fields processing in Form
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#28179
| License | MIT
Commits
-------
c73b042044 bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
This PR was merged into the 3.4 branch.
Discussion
----------
[Console] SymonfyStyle - Check value isset to avoid PHP notice
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#34093
| License | MIT
| Doc PR | n/a
This PR addresses the issue when a default value is not a valid choice. Currently this would throw a notice which outputs to the console.
This fix is a similar implementation to the `QuestionHelper`: https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Console/Helper/QuestionHelper.php#L63
Example console command and output can be found in the issue: #34093
Commits
-------
c9072c70ef Check value isset to avoid PHP notice
This PR was merged into the 5.1-dev branch.
Discussion
----------
[HttpClient] dont display any content when none has been collected
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Commits
-------
36536c94d2 [HttpClient] dont display any content when none has been collected
This PR was merged into the 5.0 branch.
Discussion
----------
[FrameworkBundle] remove mention of the old Controller class
| Q | A
| ------------- | ---
| Branch? | 5.0
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This class is gone in 5.0.
Commits
-------
6620f8afd9 [FrameworkBundle] remove mention of the old Controller class
This PR was merged into the 5.1-dev branch.
Discussion
----------
[HttpClient] Allow pass array of callable to the mocking http client
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | not yet
For the now MockHttpClient allows pass closure as response factory. It useful for tests to perform assertions that expected request was sent. But If we are sending multiple sequental requests then it became a little bit tricky to perform assertions:
```php
<?php
$requestIndex = 0;
$expectedRequest = function ($method, $url, $options) use (&$requestIndex) {
switch (++$requestIndex) {
case 1:
$this->assertSame('GET', $method);
$this->assertSame('https://example.com/api/v1/customer', $url);
return new MockResponse(CustomerFixture::CUSTOMER_RESPONSE);
case 2:
$this->assertSame('POST', $method);
$this->assertSame('https://example.com/api/v1/customer/1/products', $url);
$this->assertJsonStringEqualsJsonFile(CustomerFixture::CUSTOMER_PRODUCT_PAYLOAD, $options['json']);
return new MockResponse();
default:
throw new \InvalidArgumentException('Too much requests');
}
};
$client = new MockHttpClient($expectedRequest);
static::$container->set('http_client.example', $client);
$commandTester->execute(['--since' => '2019-01-01 00:05:00', '--until' => '2019-01-01 00:35:00']);
$this->assertSame(2, $requestIndex, 'All expected requests was sent.');
```
This PR introduces possibility to define multiple callable response factories and `getSentRequestsCount` method to make sure that each factory was called:
```php
<?php
$expectedRequests = [
function ($method, $url, $options) {
$this->assertSame('GET', $method);
$this->assertSame('https://example.com/api/v1/customer', $url);
return new MockResponse(CustomerFixture::CUSTOMER_RESPONSE);
},
function ($method, $url, $options) {
$this->assertSame('POST', $method);
$this->assertSame('https://example.com/api/v1/customer/1/products', $url);
$this->assertJsonStringEqualsJsonFile(CustomerFixture::CUSTOMER_PRODUCT_PAYLOAD, $options['json']);
return new MockResponse();
},
];
$client = new MockHttpClient($expectedRequest);
static::$container->set('http_client.example', $client);
$commandTester->execute(['--since' => '2019-01-01 00:05:00', '--until' => '2019-01-01 00:35:00']);
$this->assertSame(2, $client->getSentRequestsCount(), 'All expected requests was sent.');
```
Also it adds a lot of tests.
Commits
-------
a36797d60e Allow pass array of callable to the mocking http client
This PR was merged into the 5.1-dev branch.
Discussion
----------
[PropertyInfo] Add accessor and mutator extractor interface and implementation on reflection
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30248, partially: #22190, #18016, #5013, #9336, #5219,
| License | MIT
| Doc PR | TODO
This PR brings accessor / mutator extraction on the PropertyInfo component,
There is no link to existing code, as IMO it should be in another PR as this will add a dependency on property access to the property info component and not sure this is something wanted (although, it will reduce a lot of code base on the property access component as a lot of code seems to be duplicated)
Code is extracted from #30248 also there is some new features (that can be removed if not wanted)
* Allow extracting private accessor / mutator (will do a new PR that improve private extraction on reflection latter)
* Allow extracting static accessor / mutators
* Allow extracting constructor mutators
Current implementation try to be as close as the PropertyAccess implementation and i did not reuse some methods already available in the class as there is some differences in implementation, but maybe it will be a good time to make this consistent (Looking forward to your input) ?
Things that should be done in a new PR:
* Linking property info to property access to remove a lot of duplicate code
* Add a new system that allow adding Virtual Property based on this extractor
Commits
-------
0a92dab753 Rebase, fix tests, review & update CHANGELOG
fc250863a8 [PropertyInfo] Add accessor and mutator extractor interface and implementation on reflection
This PR was squashed before being merged into the 5.1-dev branch (closes#35538).
Discussion
----------
[FrameworkBundle] fixed suggesting deprecated WebServerBundle
| Q | A
| ------------- | ---
| Branch? | 5.0
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35495
| License | MIT
| Doc PR |
Removed suggestion to install `symfony/web-server-bundle` in console missing packages suggestions. The web server bundle was deprecated and no longer works with Symfony 5.x, .
Commits
-------
134129b5ad [FrameworkBundle] fixed suggesting deprecated WebServerBundle
* 5.0:
[Validator] fix access to uninitialized property when getting value
[HttpClient] Fix regex bearer
[Translator] Default value for 'sort' option in translation:update should be 'asc'
[HttpKernel] Fix stale-if-error behavior, add tests
[Intl] Provide more locale translations
[Mailer] Fix STARTTLS support for Postmark and Mandrill
[Messenger] Check for all serialization exceptions during message dec…
[Messenger] Fix bug when using single route with XML config
Fix exception message in Doctrine Messenger
[DI] CheckTypeDeclarationsPass now checks if value is type of parameter type
[SecurityBundle] fix security.authentication.provider.ldap_bind arguments
Improved error message when no supported user provider is found
Mysqli doesn't support the named parameters used by PdoAdapter
Added debug argument to decide if debug page should be shown or not
Mysqli doesn't support the named parameters used by PdoStore
Properly handle phpunit arguments for configuration file
[Mailer] add tests for http transports
* 4.4:
[Validator] fix access to uninitialized property when getting value
[HttpClient] Fix regex bearer
[Translator] Default value for 'sort' option in translation:update should be 'asc'
[HttpKernel] Fix stale-if-error behavior, add tests
[Intl] Provide more locale translations
[Mailer] Fix STARTTLS support for Postmark and Mandrill
[Messenger] Check for all serialization exceptions during message dec…
[Messenger] Fix bug when using single route with XML config
Fix exception message in Doctrine Messenger
[DI] CheckTypeDeclarationsPass now checks if value is type of parameter type
[SecurityBundle] fix security.authentication.provider.ldap_bind arguments
Improved error message when no supported user provider is found
Mysqli doesn't support the named parameters used by PdoAdapter
Added debug argument to decide if debug page should be shown or not
Mysqli doesn't support the named parameters used by PdoStore
Properly handle phpunit arguments for configuration file
[Mailer] add tests for http transports
* 4.3:
[Validator] fix access to uninitialized property when getting value
[HttpClient] Fix regex bearer
[HttpKernel] Fix stale-if-error behavior, add tests
Improved error message when no supported user provider is found
Properly handle phpunit arguments for configuration file
* 3.4:
[Validator] fix access to uninitialized property when getting value
[HttpKernel] Fix stale-if-error behavior, add tests
Improved error message when no supported user provider is found
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Mailer] Randomize the first transport used by the RoundRobin transport
| 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#33723 <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
When not using Messenger, and so sending only one message, the RoundRobin class does not work as the first transport is always used. This PR randomizes the first transport used by the class to mitigate that problem.
Commits
-------
6ebe83c14e [Mailer] Randomize the first transport used by the RoundRobin transport
This PR was squashed before being merged into the 5.1-dev branch (closes#35116).
Discussion
----------
[Validator] Add alpha3 option to country constraint
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/12857
A following of #33791 and #32988 to add `alpha3` option also to `Country` constraint in the validator component.
Commits
-------
d6f34a5df6 [Validator] Add alpha3 option to country constraint
This PR was squashed before being merged into the 5.1-dev branch (closes#29139).
Discussion
----------
[FrameworkBundle][TranslationDebug] Return non-zero exit code on failure
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | TBD
This PR introduces non-zero exit codes upon failure for the `debug:translations` command. The addition can be useful for projects which wish to determine results easily in CI.
The exit code returned can be interpreted as a bit array and to determine what failed, one could Bitwise AND the returned exit code to determine what failed.
Exit Codes:
| Failure Reason | bit array | integer |
| ---------------- | --------- | --------- |
| General Failure (i.e no translations at all) | `1000000` | 64 |
| Missing Translations | `1000001` | 65 |
| Unused Translations | `1000010` | 66 |
| Fallback Translations | `1000100` | 68 |
Example: Given there are missing and unused translations, the expected status code would be `TranslationDebugCommand::EXIT_CODE_MISSING | TranslationDebugCommand::EXIT_CODE_UNUSED`, which would be evaluated to `67`.
Commits
-------
0baafd8bc5 [FrameworkBundle][TranslationDebug] Return non-zero exit code on failure
This PR was squashed before being merged into the 4.4 branch (closes#35486).
Discussion
----------
[Translator] Default value for 'sort' option in translation:update should be 'asc'
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
The value for 'sort' option for `bin/console translation:update --sort` is optional, but no default value is defined. So the list isn't sorted if no value is explicitly defined.
This MR brings a default value "asc" if no value is defined, so the list is correctly sorted.
Commits
-------
fdb13c8ab8 [Translator] Default value for 'sort' option in translation:update should be 'asc'
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Mailer] added tag/metadata support
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#35047
| License | MIT
| Doc PR | todo
This is an alternative to #34766 for adding tag and metadata support in a more generalized way.
Most transports allow for open/click tracking headers - maybe this should be handled in a similar way?
I added implementations for the Postmark (SMTP and API) and Mailgun (SMTP and API) transports. I can add others and tests/docs if this is acceptable.
### Example:
```php
use Symfony\Component\Mailer\Header\MetadataHeader;
use Symfony\Component\Mailer\Header\TagHeader;
$email->getHeaders()->add(new TagHeader('password-reset'));
$email->getHeaders()->add(new MetadataHeader('Color', 'blue'));
$email->getHeaders()->add(new MetadataHeader('Client-ID', '12345'));
```
The Postmark/Mailgun providers will parse these into their own headers/payload. For transports that don't support tags/metadata, these are just added as custom headers:
```
X-Tag: password-reset
X-Metadata-Color: blue
X-Metadata-Client-ID: 12345
```
Commits
-------
f2cdafcae0 [Mailer] added tag/metadata support
This PR was squashed before being merged into the 3.4 branch (closes#35305).
Discussion
----------
[HttpKernel] Fix stale-if-error behavior, add tests
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #24248
| License | MIT
| Doc PR |
This PR adds the first tests for `stale-if-error` logic in `HttpCache`.
It also fixes an observation from #24248: For responses that have been cached as `public` with an `ETag` but without a lifetime, in case of an error the stale response will be served forever (= as long as the error persists), even beyond the configured `stale-if-error` grace period.
Furthermore, it tries to improve compliance with RFC 7234: Stale responses must not be sent (under no condition) if one of
* `no-cache`
* `must-revalidate`
* `proxy-revalidate` or
* `s-maxage` (sic) is present.
This can be found in the corresponding chapters of Section 5.2.2 for these directives, but is also summarized in [Section 4.2.4](https://tools.ietf.org/html/rfc7234#section-4.2.4) as
> A cache MUST NOT generate a stale response if it is prohibited by an explicit in-protocol directive (e.g., by a "no-store" or "no-cache" cache directive, a "must-revalidate" cache-response-directive, or an applicable "s-maxage" or "proxy-revalidate" cache-response-directive; see Section 5.2.2).
Because disabling of `stale-if-error` for `s-maxage` responses probably has a big impact on the usefulness of that feature in practice, it has to be enabled explicitly with a new config setting `strict_smaxage` (defaulting to `false`).
Commits
-------
ad5f427bed [HttpKernel] Fix stale-if-error behavior, add tests
This PR was squashed before being merged into the 5.1-dev branch (closes#35215).
Discussion
----------
[HttpFoundation] added withers to Cookie class
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#35212
| License | MIT
| Doc PR | -
I was quite descriptive in the issue :-)
The main idea is to get the interface for changing a cookie to avoid every unneeded argument in the constructor.
Current:
```php
$cookie = Cookie::create(
RegionSwitcher::REGION_COOKIE, $regionSlug, new DateTime('+1 year'), '/',
$baseDomain, null, false
);
```
This PR:
```php
$cookie = Cookie::create('foo')
->withValue('bar')
->withExpiresTime(strtotime('Fri, 20-May-2011 15:25:52 GMT'))
->withDomain('.myfoodomain.com')
->withSecure(true);
```
Every `wither` returns a copy of current cookie with requested setting set. Cookie class remains immutable.
Commits
-------
549afaab17 [HttpFoundation] added withers to Cookie class
This PR was merged into the 4.3 branch.
Discussion
----------
[PhpUnitBridge] Properly handle phpunit arguments for configuration file
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
PhpUnitBridge should properly parse cli arguments for configuration file.
After fixing #34300 the PhpUnitBridge stopped recognizing short `-c` option.
Also original PHPUnit allows to pass a directory as configuration parameter and read from either phpunit.xml or phpunit.xml.dist
Commits
-------
a7a5885661 Properly handle phpunit arguments for configuration file
This PR was merged into the 5.1-dev branch.
Discussion
----------
[DI][Routing] add wither to configure the path of PHP-DSL configurators
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This makes PHP-DSL configurators more flexible, by allowing to use them for a different path than they were initially created for.
Sidekick of https://github.com/symfony/recipes/pull/721
Commits
-------
8f92c85689 [DI][Routing] add wither to configure the path of PHP-DSL configurators
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Notifier] Fix infinite loop on round robin transport
| 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 | - <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Commits
-------
c16ee4a894 [Notifier] Fix infinite loop on round robin transport
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Mailer] Make default factories public
| 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#35469 <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
To allow registering new factories and keep the default ones available.
Commits
-------
c9863c6a6c [Mailer] Make default factories public
This PR was merged into the 5.1-dev branch.
Discussion
----------
[String] Made AbstractString::width() follow POSIX.1-2001
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This PR ports the wcswidth() function (see http://man7.org/linux/man-pages/man3/wcwidth.3.html and https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c) into the String component. This new method will be useful in the Console component to determine how many columns a character takes.
I kind of copied the Intl data import strategy.
Commits
-------
347d8252fb [String] Made AbstractString::width() follow POSIX.1-2001
This PR was squashed before being merged into the 5.1-dev branch (closes#35440).
Discussion
----------
Sort the KernelEvents constants to match the lifecycle of the framework
| 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 | -
This PR is the same as #35248 but on the correct branch this time!
> Hi,
>
> When I need to visualize all the kernel events I often open the KernelEvents file. However, it is difficult to navigate through it because the constants are not in the same order compared to the framework execution life cycle.
>
> This PR aims to sort this constants to match it. It's also the same order used in [this documentation page](https://symfony.com/doc/current/reference/events.html).
>
> Thanks.
Commits
-------
a447cba26c Sort the KernelEvents constants to match the lifecycle of the framework
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Dotenv] Add Dotenv::bootEnv() to check for .env.local.php before calling Dotenv::loadEnv()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | yes
| Tickets | -
| License | MIT
| Doc PR | -
The goal of this PR is to eventually get rid of the `config/bootstrap.php` file in Symfony 5.1 apps.
I think we've done enough iterations on that piece of bootstrapping logic to put it inside the `Dotenv` component.
This fully replaces https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/4.2/config/bootstrap.php
It doesn't conflict with current apps so they'll be fine keeping the `config/bootstrap.php` file until they're upgraded.
The new bootstrapping logic will require adding this line in `bin/console` and `public/index.php`:
```php
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
```
Recipes updated at https://github.com/symfony/recipes/pull/724
Commits
-------
98c7d3027b [Dotenv] Add Dotenv::bootEnv() to check for .env.local.php before calling Dotenv::loadEnv()
This PR was merged into the 4.4 branch.
Discussion
----------
[Mailer] add tests for http transports
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | none
| License | MIT
Commits
-------
df30a176ac [Mailer] add tests for http transports
This PR was merged into the 4.4 branch.
Discussion
----------
[Mailer] Fix STARTTLS support for Postmark and Mandrill
| Q | A
| ------------- | ---
| Branch? | 4.4
| 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#34846 <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | n/a
Commits
-------
44b27c6816 [Mailer] Fix STARTTLS support for Postmark and Mandrill
This PR was squashed before being merged into the 5.1-dev branch (closes#35271).
Discussion
----------
[PHPUnitBridge] Improved deprecations display
| Q | A
| ------------- | ---
| Branch? | master for features
| 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 | todo
- [x] Ignore verbose when the build fails because of deprecations
- [x] Add per-group verbosity : it is now possible to make the report a lot quieter, by specifying which groups should become quiet, like this: `quiet[]=indirect&quiet[]=direct`
Might add more improvements to that branch if people suggest some.
Commits
-------
c55a89e4ff [PHPUnitBridge] Improved deprecations display
This PR was squashed before being merged into the 5.1-dev branch (closes#35478).
Discussion
----------
[Console] Add constants for main exit codes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? |no
| Tickets | Fix#35431
| License | MIT
Commits
-------
5f6a1acaac [Console] Add constants for main exit codes
This PR was squashed before being merged into the 5.1-dev branch (closes#35262).
Discussion
----------
[Mailer] add ability to disable the TLS peer verification via DSN
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix
| License | MIT
| Doc PR | symfony/symfony-docs/pull/12997
Add the ability to disable the peer TLS verification with the DNS when using `EsmtpTransport` like this :
```
MAILER_DSN=smtp://foo@default?verify_peer=false
```
By default the verification is enabled
Commits
-------
4b854da73e [Mailer] add ability to disable the TLS peer verification via DSN
This PR was squashed before being merged into the 5.1-dev branch (closes#35422).
Discussion
----------
[Messenger] Move Transports to separate packages
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | coming
I think it is a good idea to have the transports in a separate package. The benefits a many:
- It allows us to have usage statistics
- The core messenger package is smaller
- Transports can have dependencies specified in composer.json instead of just suggests
This PR will not break BC but it requires to configure subtree split.
Commits
-------
2990c8f1e7 [Messenger] Move Transports to separate packages
This PR was merged into the 5.1-dev branch.
Discussion
----------
[CssSelector] Added cache on top of CssSelectorConverter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
ed11d526d9 [CssSelector] Added cache on top of CssSelectorConverter
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Cache] Add LRU + max-lifetime capabilities to ArrayCache
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix https://github.com/orgs/symfony/projects/1#card-30686676
| License | MIT
| Doc PR | -
In https://github.com/symfony/symfony/pull/32294#issuecomment-508067745, @andrerom writes:
> if you plan to expose use of ArrayAdapter to a wider audience you should probably also add the following features to it:
> - max item limit to avoid reaching memory limits
> - own (very low, like default 100-500ms) TTL for in-memory caching, as it's in practice stale data when used in concurrent scenarios
>
> If you want to be advance you can also:
>
> - keep track of use, and evict cache items based on that using LFU when reaching limit
> - in-memory cache is domain & project specific in terms of how long it's somewhat "safe" to keep items in memory, so either describe when to use and not use on a per pool term, or allow use of pool to pass in flags to opt out of in-memory cache for cases developer knows it should be ignored
This PR implements these suggestions, via two new constructor arguments: `$maxLifetime` and `$maxItems`.
In Yaml:
```yaml
services:
app.lru150_cache:
parent: cache.adapter.array
arguments:
$maxItems: 150
$maxLifetime: 0.150
framework:
cache:
pools:
my_chained_pool:
adapters:
- app.lru150_cache
- cache.adapter.filesystem
```
This configuration adds a local memory cache that keeps max 150 elements for 150ms on top of a filesystem cache.
/cc @lyrixx since you were also interested in it.
Commits
-------
48a5d5e8a9 [Cache] Add LRU + max-lifetime capabilities to ArrayCache
This PR was merged into the 4.3 branch.
Discussion
----------
[Lock] Don't allow mysqli to be used as it doesn't work
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Mysqli doesn't support named parameters, so if you pass a doctrine connection using `mysqli` then you get the following error:
`You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':id, :token, UNIX_TIMESTAMP() + 300)'`
This PR ensures a clear error is provided and suggests to use `pdo_mysql` instead
Commits
-------
ef3bcda5e3 Mysqli doesn't support the named parameters used by PdoStore
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Console] Set Command::setHidden() final for adding default param in SF 6.0
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
e2ede070fa [Console] Add default parameter (true) for Command::setHidden()
This PR was merged into the 4.4 branch.
Discussion
----------
[SecurityBundle] fix ldap_bind service arguments
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
The 6th argument of `LdapBindAuthenticationProvider` was not correctly set in the service declaration `security_listeners.xml`. Thus, instead `'Invalid credentials.'` we had `'User "foo" not found.'`.
Commits
-------
7ec6a090da [SecurityBundle] fix security.authentication.provider.ldap_bind arguments
This PR was merged into the 4.4 branch.
Discussion
----------
[DI] CheckTypeDeclarationsPass now checks if value is type of parameter type
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #35420
| License | MIT
Commits
-------
0d4c0a6492 [DI] CheckTypeDeclarationsPass now checks if value is type of parameter type
This PR was merged into the 4.4 branch.
Discussion
----------
[ErrorHandler] Add debug argument to decide whether debug page is shown or not
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35448
| License | MIT
| Doc PR | -
This ensures that the debug page (with stack trace) won't be (by default) displayed in non-CLI context when an early error occurs (after FB::boot()) in non-debug mode (prod). And `Debug::enable()` will enable it explicitly.
Commits
-------
cf80224589 Added debug argument to decide if debug page should be shown or not
* 5.0: (21 commits)
[DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion
Fix testing with mongodb
suggest a non-deprecated function replacement
Minor Travis cosmetic patch
[Cache] fix checking for igbinary availability
[HttpKernel] Check if lock can be released
Fixes a runtime error (Impossible to access an attribute ("value") on a double variable...) when accessing the cache panel (@see #35419)
bumped Symfony version to 5.0.4
updated VERSION for 5.0.3
updated CHANGELOG for 5.0.3
bumped Symfony version to 4.4.4
updated VERSION for 4.4.3
updated CHANGELOG for 4.4.3
bumped Symfony version to 4.3.11
updated VERSION for 4.3.10
updated CHANGELOG for 4.3.10
bumped Symfony version to 3.4.38
updated VERSION for 3.4.37
update CONTRIBUTORS for 3.4.37
updated CHANGELOG for 3.4.37
...
* 4.4:
[DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion
Fix testing with mongodb
suggest a non-deprecated function replacement
Minor Travis cosmetic patch
[Cache] fix checking for igbinary availability
[HttpKernel] Check if lock can be released
Fixes a runtime error (Impossible to access an attribute ("value") on a double variable...) when accessing the cache panel (@see #35419)
bumped Symfony version to 4.4.4
updated VERSION for 4.4.3
updated CHANGELOG for 4.4.3
bumped Symfony version to 4.3.11
updated VERSION for 4.3.10
updated CHANGELOG for 4.3.10
bumped Symfony version to 3.4.38
updated VERSION for 3.4.37
update CONTRIBUTORS for 3.4.37
updated CHANGELOG for 3.4.37
[FrameworkBundle] Add --show-arguments example to debug:container command help text
This PR was merged into the 4.4 branch.
Discussion
----------
Fixes a runtime error when accessing the cache panel
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35419
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Fixes a runtime error (_Impossible to access an attribute ("value") on a double variable..._) when accessing the cache panel on 4.4.3
Commits
-------
4740b10132 Fixes a runtime error (Impossible to access an attribute ("value") on a double variable...) when accessing the cache panel (@see #35419)
This PR was merged into the 4.4 branch.
Discussion
----------
[Security] suggest a non-deprecated function replacement
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35437
| License | MIT
| Doc PR |
Commits
-------
731730fe2f suggest a non-deprecated function replacement
* 4.3:
[DoctrineBridge] [DX] Improve condition for exception text in ManagerRegistry to avoid confusion
Fix testing with mongodb
Minor Travis cosmetic patch
[Cache] fix checking for igbinary availability
bumped Symfony version to 4.3.11
updated VERSION for 4.3.10
updated CHANGELOG for 4.3.10
bumped Symfony version to 3.4.38
updated VERSION for 3.4.37
update CONTRIBUTORS for 3.4.37
updated CHANGELOG for 3.4.37
This PR was merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] Add --show-arguments example to debug:container command help text
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | - <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | - <!-- required for new features -->
I like this option a lot and I think it deserves to be mentioned in the command help text :-)
Commits
-------
f703a58215 [FrameworkBundle] Add --show-arguments example to debug:container command help text
This PR was merged into the 3.4 branch.
Discussion
----------
[Security] Use supportsClass in addition to UnsupportedUserException
| Q | A
| ------------- | ---
| Branch? | 3.4+
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35045
| License | MIT
| Doc PR | ~
This PR fixes the issue where user providers rely on just the UnsupportedUserException from `refreshUser()`, causing a flow where users are wrongfully re-authenticated.
There's one issue where `refreshUser()` can do far more sophisticated checks on the user class, which it will never reach if the class is not supported. As far as I know it was never intended to support instances that are rejected by `supportsClass()`, though people could've implemented this (by accident). So the question is more if we should add a BC layer for this; for example:
```php
try {
$refreshedUser = $provider->refreshUser($user);
$newToken = clone $token;
$newToken->setUser($refreshedUser);
if (!$provider->supportsClass($userClass)) {
if ($this->shouldCheckSupportsClass) {
continue;
}
// have to think of a proper deprecation here for 6.0
@trigger_error('Provider %s does not support user class %s via supportsClass() while it does support it via refreshUser .. please set option X and fix %s::supportsUser() ', E_USER_DEPRECATED);
}
```
This would prevent behavior from breaking but also means we can't fix this on anything less than 5.1.
Commits
-------
d3942cbe17 Use supportsClass where possible
* 5.0:
[Filesystem] chown and chgrp should also accept int as owner and group
[DI] Fix EnvVar not loaded when Loader requires an env var
Fixed#34713 Move new messages to intl domain when possible
[FrameworkBundle] Fix small typo in output comment
chown and chgrp should also accept int as owner and group
Revert "Fixed translations file dumper behavior"
Fix RememberMe with null password
[Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages
Set booted flag to false when test kernel is unset
[FrameworkBundle] remove messenger cache if not enabled
[PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
[HttpClient] Fix strict parsing of response status codes
fix PHP const mapping keys using the inline notation
[SecurityBundle] Drop duplicated code
[FrameworkBundle] Make sure one can use fragments.hinclude_default_template
Fix that no-cache requires positive validation with the origin, even for fresh responses
Improve upgrading instructions for deprecated router options
[DI] Suggest typed argument when binding fails with untyped argument
* 4.4:
[DI] Fix EnvVar not loaded when Loader requires an env var
Fixed#34713 Move new messages to intl domain when possible
[FrameworkBundle] Fix small typo in output comment
chown and chgrp should also accept int as owner and group
Revert "Fixed translations file dumper behavior"
Fix RememberMe with null password
[Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages
Set booted flag to false when test kernel is unset
[FrameworkBundle] remove messenger cache if not enabled
[PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
[HttpClient] Fix strict parsing of response status codes
fix PHP const mapping keys using the inline notation
[SecurityBundle] Drop duplicated code
[FrameworkBundle] Make sure one can use fragments.hinclude_default_template
Fix that no-cache requires positive validation with the origin, even for fresh responses
Improve upgrading instructions for deprecated router options
[DI] Suggest typed argument when binding fails with untyped argument
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
Revert #34797 "Fixed translations file dumper behavior" and fix#34713
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35264
| License | MIT
| Doc PR | -
Revert https://github.com/symfony/symfony/pull/34797
See also https://github.com/symfony/symfony/issues/35328
It's very likely that the new way will be completely different from this one that is being reverted. That's why I'm reverting rather than fixing it.
Commits
-------
9ca872054bFixed#34713 Move new messages to intl domain when possible
56e79fefa1 Revert "Fixed translations file dumper behavior"
This PR was merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] Fix small typo in output comment
| Q | A
| ------------- | ---
| Branch? | 4.4 <!-- see below -->
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | - <!-- prefix each issue number with "Fix #", if any -->
| 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/roadmap):
- 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
-------
d18f5ed851 [FrameworkBundle] Fix small typo in output comment
* 4.3:
chown and chgrp should also accept int as owner and group
Fix RememberMe with null password
[Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages
[PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
fix PHP const mapping keys using the inline notation
Fix that no-cache requires positive validation with the origin, even for fresh responses
* 3.4:
chown and chgrp should also accept int as owner and group
Fix RememberMe with null password
[Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages
[PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
fix PHP const mapping keys using the inline notation
Fix that no-cache requires positive validation with the origin, even for fresh responses
* 4.3:
[FrameworkBundle] remove messenger cache if not enabled
[HttpClient] Fix strict parsing of response status codes
[DI] Suggest typed argument when binding fails with untyped argument
This PR was merged into the 3.4 branch.
Discussion
----------
[PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Risky errors when there are no assertions are added before the test end listeners are called (ie, before the code in endTest is executed) so forcing beStrictAboutTestsThatDoNotTestAnything to false when there is a expectedDeprecation annotation is enough.
If the goal is to reset the value to the original value, then I think we should not do it since we basically "lie" to the next listeners. Let's assume that when a test expect a deprecation, it can have 0 assertions. Also this flag is not used anymore by PHPUnit after we reset it.
Ref https://github.com/symfony/symfony/pull/21786 btw
Commits
-------
fb48bbc05b [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
This PR was merged into the 5.0 branch.
Discussion
----------
[Security] Fix RememberMe with null password
| Q | A
| ------------- | ---
| Branch? | 5.0
| Bug fix? | yes
| New feature? | no
| Deprecations? | yes
| Tickets | NA
| License | MIT
| Doc PR | NA
From `UserInterface` the method getPassword may return null, while generateCookieHash requires a string.
This PR changes the signature of the methods to allows null password
Commits
-------
a7d0d82768 Fix RememberMe with null password
This PR was merged into the 4.4 branch.
Discussion
----------
[DI] Fix EnvVar not loaded when Loader requires an env var
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #35348
| License | MIT
| Doc PR | NA
When an EnvVarLoader has a dependency on an Env Var tried to be loaded (which is the case for SodiumVault that is configured with `default::SYMFONY_DECRYPTION_SECRET`) the Loader is not usable.
What happens:
- when trying to resolve `SYMFONY_DECRYPTION_SECRET`, the EnvVarProcessor iterates over loaders
- given SodiumVaultLoaders requires the same env variable `SYMFONY_DECRYPTION_SECRET`, it throws a `ParameterCircularReferenceException`
- letting the $loaders generator invalid
This PR, refactor the way loaders are iterated in order to rewind on failure.
Commits
-------
e119aa6c48 [DI] Fix EnvVar not loaded when Loader requires an env var
This PR was merged into the 3.4 branch.
Discussion
----------
[Filesystem] chown and chgrp should also accept int as owner and group (3.4)
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Reference: https://github.com/symfony/symfony/pull/35356#issuecomment-575526299
Commits
-------
6b811e6b4c chown and chgrp should also accept int as owner and group
This PR was merged into the 3.4 branch.
Discussion
----------
[Validator] Fix plurals for sr_Latn validation messages
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35276
| License | MIT
validators.sr_Latn.xlf (Serbian, written with latin script) has wrong plurals for all validation message translations that require them (only two where there should be three). This commit fixes that by adding the missing third plural-translation.
Commits
-------
207cdafd54 [Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages
This PR was merged into the 4.3 branch.
Discussion
----------
[DI] Suggest typed argument when binding fails with untyped argument
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #33470
| License | MIT
I've added a condition that looks for arguments and if the typehint doesn’t match, throws an `InvalidArgumentException`
Commits
-------
0e92399daa [DI] Suggest typed argument when binding fails with untyped argument
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Workflow] Added a way to not fire the announce event
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#35286
| License | MIT
| Doc PR |
Commits
-------
d31939d01d [Workflow] Added a way to not fire the annonce event
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Serializer] Added scalar denormalization
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#33784
| License | MIT
Was added an ability to deserialize scalar data (single or array).
Commits
-------
dad04d0adf Added scalar denormalization in Serializer + added scalar normalization tests
This PR was merged into the 5.1-dev branch.
Discussion
----------
[FrameworkBundle] Deprecate *not* setting the "framework.router.utf8" option
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | -
| License | MIT
| Doc PR | -
The goal here is to get rid of the `config/packages/routing.yaml` file in Symfony 6.
This should have no practical impact as all new apps already define this setting for 2 years.
Commits
-------
84849bc96a [FrameworkBundle] Deprecate *not* setting the "framework.router.utf8" option
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Yaml] Added yaml-lint binary
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | no
| New feature? | yes
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix#18987 <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | tbd.
<!--
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/roadmap):
- 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 4.4.
- Legacy code removals go to the master branch.
-->
Commits
-------
2640dfedfa [Yaml] Introduce yaml-lint binary
This PR was merged into the 3.4 branch.
Discussion
----------
[HttpKernel] Fix that no-cache MUST revalidate with the origin
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
From [RFC 7234 Section 5.2.2](https://tools.ietf.org/html/rfc7234#section-5.2.2)
> The "no-cache" response directive indicates that the response MUST NOT be used to satisfy a subsequent request without successful validation on the origin server. This allows an origin server to prevent a cache from using it to satisfy a request without contacting it, even by caches that have been configured to send stale responses.
This is unconditional – the response must be revalidated right away.
(`must-revalidate`, to the contrary, requires revalidation only once the response has become stale.)
Commits
-------
c8bdcb3408 Fix that no-cache requires positive validation with the origin, even for fresh responses
This PR was merged into the 5.1-dev branch.
Discussion
----------
[FrameworkBundle] Add missing entry about framework.router.context
| 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 | Relates to #35281 <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | N/A
Some minor tweaks about #35281
Commits
-------
5a83b07bf4 [FrameworkBundle] Add missing entry about framework.router.context
* 5.0:
Avoid stale-if-error if kernel.debug = true, because it hides errors
[Console] Fix SymfonyQuestionHelper tests sometimes failing on AppVeyor
[SecurityBundle] Fix collecting traceable listeners info using anonymous: lazy
[Filesystem][FilesystemCommonTrait] Use a dedicated directory when there are no namespace
[Workflow] Fix configuration node reference for "initial_marking"
expand listener in place
[DI] deferred exceptions in ResolveParameterPlaceHoldersPass
Do not throw exception on valut generate key
* 4.4:
Avoid stale-if-error if kernel.debug = true, because it hides errors
[Console] Fix SymfonyQuestionHelper tests sometimes failing on AppVeyor
[SecurityBundle] Fix collecting traceable listeners info using anonymous: lazy
[Filesystem][FilesystemCommonTrait] Use a dedicated directory when there are no namespace
[Workflow] Fix configuration node reference for "initial_marking"
expand listener in place
[DI] deferred exceptions in ResolveParameterPlaceHoldersPass
Do not throw exception on valut generate key
* 4.3:
Avoid stale-if-error if kernel.debug = true, because it hides errors
[Console] Fix SymfonyQuestionHelper tests sometimes failing on AppVeyor
[Workflow] Fix configuration node reference for "initial_marking"
expand listener in place
[DI] deferred exceptions in ResolveParameterPlaceHoldersPass
* 3.4:
Avoid stale-if-error if kernel.debug = true, because it hides errors
[Console] Fix SymfonyQuestionHelper tests sometimes failing on AppVeyor
[DI] deferred exceptions in ResolveParameterPlaceHoldersPass
This PR was squashed before being merged into the 5.1-dev branch (closes#35257).
Discussion
----------
[FrameworkBundle] TemplateController should accept extra arguments to be sent to the template
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | symfony/symfony-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/roadmap):
- 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.
-->
In the official documentation (symfony.com/doc/master/templates.html#rendering-a-template-directly-from-a-route) it says that TemplateController should accept extra arguments. In fact it's not available for instance.
So i added the context argument as an array. Because of deprecation of templating, only the twig instance will apply the context argument.
It will need to be implemented in branch 5.
The following issue has been created in documentation project : https://github.com/symfony/symfony-docs/issues/12897
Commits
-------
e27b417817 [FrameworkBundle] TemplateController should accept extra arguments to be sent to the template
This PR was squashed before being merged into the 5.1-dev branch (closes#34980).
Discussion
----------
[Messenger] remove several messages with command messenger:failed:remove
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#34940
| License | MIT
command `messenger:failed:remove` now accepts an array of ids. If several provided, they are not displayed unless option `--show-messages` is passed
Commits
-------
903455e463 [Messenger] remove several messages with command messenger:failed:remove
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Validator] Added HostnameValidator
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #10088 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
This PR adds HostnameValidator support. I encountered this need in my project and was surprised that this issue has been open for years.
Here is short example:
```
App\Entity\Acme:
properties:
domain:
- Hostname: ~
non_tld_domain:
- Hostname: { requireTld: false }
```
The option `requireTld` is `true` by default and disallows domains like localhost and etc.
Commits
-------
8a08c2090a Added HostnameValidator
This PR was squashed before being merged into the 5.1-dev branch (closes#35284).
Discussion
----------
Simplify UriSigner when working with HttpFoundation's Request
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
I'm using the `UriSigner` in my own projects from time to time and I've always wondered why I have to manually generate the URI from the `Request` instance in such a way that it is correctly validated.
Let's add a new `checkRequest(Request $request)` method to provide better DX.
Commits
-------
4887b4bee1 Simplify UriSigner when working with HttpFoundation's Request
This PR was merged into the 5.1-dev branch.
Discussion
----------
[FrameworkBundle] Adding better output to secrets:decrypt-to-local command
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | none
| License | MIT
| Doc PR | not needed
Hi!
The `secrets:decrypt-to-local` doesn't give any output. This adds some basic details:
<img width="1280" alt="Screen Shot 2020-01-09 at 11 53 54 AM" src="https://user-images.githubusercontent.com/121003/72087704-ebe0f480-32d6-11ea-950c-c698abde783d.png">
(note the `-vvv` wasn't necessary in the command to show the output). And the `<info>`part is fixed.
Cheers!
Commits
-------
a6aa9781eb Adding better output to secrets:decrypt-to-local command
This PR was merged into the 5.1-dev branch.
Discussion
----------
[HttpClient] Add LoggerAwareInterface to ScopingHttpClient and TraceableHttpClient
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
This allows changing the logger when using `ScopingHttpClient` (and `TraceableHttpClient` during dev)
Commits
-------
1137bdc3f7 Add LoggerAwareInterface to ScopingHttpClient and TraceableHttpClient
This PR was merged into the 5.1-dev branch.
Discussion
----------
Add support for safe HTTP preference - RFC 8674
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
[RFC 8674](https://tools.ietf.org/html/rfc8674) (not a IETF standard at the moment) defines a way for user agents to ask for "safe" content to a server. This PR add helper methods to :
- know if the user agent prefers a safe content
- mark the response as safe
Commits
-------
7f2cef759c Add support for safe preference - RFC8674
This PR was squashed before being merged into the 5.1-dev branch (closes#34880).
Discussion
----------
[Twig][Form] Twig theme for Foundation 6
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | -
Hi,
I propose a form theme for Foundation 6. This layout stylizes buttons, percent / money widgets and permits switch inputs adding a 'switch-input' attribute (as for https://symfony.com/blog/new-in-symfony-4-4-bootstrap-custom-switches).
![Foundation_6](https://user-images.githubusercontent.com/10855303/70390292-184cdc80-19ca-11ea-8ad8-090358dd9e35.png)
```php
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
// ...
->add('checkbox-switch', Type\CheckboxType::class, [
'attr' => [
'class' => 'switch-input',
],
])
;
}
```
Commits
-------
e47a134db0 [Twig][Form] Twig theme for Foundation 6
This PR was merged into the 3.4 branch.
Discussion
----------
[DI] deferred exceptions in ResolveParameterPlaceHoldersPass
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#30428
| License | MIT
| Doc PR | n/a
fixes case #30428
implemented as in AutowiringPass
Commits
-------
b3a2173c8e [DI] deferred exceptions in ResolveParameterPlaceHoldersPass
This PR was merged into the 5.1-dev branch.
Discussion
----------
[FrameworkBundle] Configure RequestContext through router config
| 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#35229 <!-- prefix each issue number with "Fix #", if any -->
| License | MIT
| Doc PR | symfony/symfony-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/roadmap):
- 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.
-->
- [ ] PR on symfony/symfony-docs
Commits
-------
6658900703 [FrameworkBundle] Configure RequestContext through router config
This PR was merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] Do not throw exception on value generate key
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
When using env variable instead of key files and creating a new Secret, the check in `generateKeys` (called by the command `SecretsSetCommand`) prevents generating a secret.
reproducer:
```
$ rm config/secrets/prod/prod.decrypt.private.php
$ export SYMFONY_DECRYPTION_SECRET=XXX
$ ./bin/console secret:set FOO
In SodiumVault.php line 50:
Cannot generate keys when a decryption key has been provided while instantiating the vault.
```
This PR converts the exception in a warning message.
Commits
-------
2f608b4dfa Do not throw exception on valut generate key
This PR was merged into the 4.3 branch.
Discussion
----------
[EventDispatcher] expand listener in place
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35259
| License | MIT
| Doc PR |
Commits
-------
f5d407318d expand listener in place
* 5.0:
[String] add test case for wordwrap method
[Process] - update @throws phpdoc
[PHPUnitBridge] file_get_contents() expects parameter 3 to be resource
[PHPUnit-Bridge] Fail-fast in simple-phpunit if one of the passthru() commands fails
[HttpKernel][FileLocator] Fix deprecation message
* 4.4:
[Process] - update @throws phpdoc
[PHPUnitBridge] file_get_contents() expects parameter 3 to be resource
[PHPUnit-Bridge] Fail-fast in simple-phpunit if one of the passthru() commands fails
[HttpKernel][FileLocator] Fix deprecation message
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpKernel][FileLocator] Fix deprecation message
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Ref https://github.com/symfony/symfony/pull/34886
`$deprecatedPath` is the foreach value so it only works if the last element triggers the deprecation, otherwise the value is wrong.
Commits
-------
18ce8399d2 [HttpKernel][FileLocator] Fix deprecation message
* 4.3:
[Process] - update @throws phpdoc
[PHPUnitBridge] file_get_contents() expects parameter 3 to be resource
[PHPUnit-Bridge] Fail-fast in simple-phpunit if one of the passthru() commands fails
* 3.4:
[PHPUnitBridge] file_get_contents() expects parameter 3 to be resource
[PHPUnit-Bridge] Fail-fast in simple-phpunit if one of the passthru() commands fails
This PR was squashed before being merged into the 3.4 branch.
Discussion
----------
[PHPUnitBridge] file_get_contents() expects parameter 3 to be resource
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
file_get_contents 3rd parameter (context) expects resource or NULL to ignore them
Commits
-------
a28a42187c [PHPUnitBridge] file_get_contents() expects parameter 3 to be resource
This PR was squashed before being merged into the 3.4 branch.
Discussion
----------
[PHPUnit-Bridge] Fail-fast in simple-phpunit if one of the passthru() commands fails
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Some commands executed by the `simple-phpunit` script are not checked for success. For example [here](https://travis-ci.org/twigphp/Twig/jobs/634110681), Composer fails with the message
```
[InvalidArgumentException]
Could not find package phpunit/phpunit with version 7.5.* in a version inst
allable using your PHP version 7.0.25.
```
Yet, the `simple-phpunit` script happily continues, going over failing `chdir()`, `file_get_contents()` and `include()` calls and eventually returns a successful `0` exit code. So CI tests look OK when in fact PHPUnit was not even downloaded.
Commits
-------
576e18561f [PHPUnit-Bridge] Fail-fast in simple-phpunit if one of the passthru() commands fails
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Console] Add SingleCommandApplication to ease creation of Single Command Application
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#34293
| License | MIT
| Doc PR |
---
```php
<?php
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;
(new SingleCommandApplication())
->setName('My Super Command') // Optional
->setVersion('1.0.0') // Optional
->setProcessTitle('my_proc_title') // Optional
->addArgument('who', InputArgument::OPTIONAL, 'Who', 'World') // Optional
->setCode(function(InputInterface $input, OutputInterface $output) {
$output->writeln(sprintf('Hello %s!', $input->getArgument('who')));
})
->run()
;
```
---
Note: I tried this too, and it works as expected:
```php
class MyCommand extends SingleCommandApplication
{
public function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('hello');
return 0;
}
}
new MyCommand();
```
Commits
-------
4af513d449 [Console] Add SingleCommandApplication to ease creation of Single Command Application
* 5.0:
[Debug] fix ClassNotFoundFatalErrorHandler
[FrameworkBundle] Document the router.cache_class_prefix parameter removal
[Routing] Fix using a custom matcher & generator dumper class
[Notifier] Add more specific types at documentation level when php engine can't
[Serializer] Fix cache in MetadataAwareNameConverter
[Dotenv] Fixed infinite loop with missing quote followed by quoted value
[HttpClient] Added missing sprintf
[TwigBridge] button_widget now has its title attr translated even if its label = null or false
[PhpUnitBridge] When using phpenv + phpenv-composer plugin, composer executable is wrapped into a bash script
[Messenger] Added check if json_encode succeeded
[Messenger] Added check if json_encode succeeded
[FrameworkBundle][ContainerLintCommand] Only skip .errored. services
[HttpClient] fix exception in case of PSR17 discovery failure
[DependencyInjection] Handle ServiceClosureArgument for callable in container linting
fix processing chain adapter based cache pool
[HttpKernel] release lock explicitly
[Security] Prevent canceled remember-me cookie from being accepted
[FrameworkBundle][TranslationUpdateCommand] Do not output positive feedback on stderr
[Security\Guard] Fix missing typehints
do not render preferred choices as selected