This PR was merged into the 5.3-dev branch.
Discussion
----------
[Runtime] a new component to decouple applications from global state
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/15081
Follow up of #36652, see discussion there.
What if we could decouple the bootstrapping logic of our apps from any global state?
This PR makes it possible via a new proposed `symfony/runtime` component.
The immediate benefit this provides is easier maintenance of Symfony apps: code that is currently shipped by recipes will be able to move to `vendor/`. Read the previous sentence twice, this is big :)
Check the following PR to see how far this goes: https://github.com/symfony/recipes/pull/787
The longer-term benefit is being able to run the exact same app under several runtimes: PHP-FPM, CLI, but also PHP-PM and similar. Thanks to the proposed interface, this benefit could span to any PHP apps; not only to apps using the Symfony HttpKernel/HttpFoundation components. This part could be moved to `symfony/contracts` in the future.
Performance-wise, I measured no significant difference with the current way of running apps.
RuntimeInterface
----------------
The core of this component is the `RuntimeInterface` which describes a high-order
runtime logic.
It is designed to be totally generic and able to run any application outside of
the global state in 6 steps:
1. the main entry point returns a callable that wraps the application;
2. this callable is passed to `RuntimeInterface::getResolver()`, which returns a
`ResolverInterface`; this resolver returns an array with the (potentially
decorated) callable at index 0, and all its resolved arguments at index 1;
3. the callable is invoked with its arguments; it returns an object that
represents the application;
4. that object is passed to `RuntimeInterface::getRunner()`, which returns a
`RunnerInterface`: an instance that knows how to "run" the object;
5. that instance is `run()` and returns the exit status code as `int`;
6. the PHP engine is exited with this status code.
This process is extremely flexible as it allows implementations of
`RuntimeInterface` to hook into any critical steps.
Autoloading
-----------
This package registers itself as a Composer plugin to generate a
`vendor/autoload_runtime.php` file. This file shall be required instead of the
usual `vendor/autoload.php` in front-controllers that leverage this component
and return a callable.
Before requiring the `vendor/autoload_runtime.php` file, set the
`$_SERVER['APP_RUNTIME']` variable to a class that implements `RuntimeInterface`
and that should be used to run the returned callable.
Alternatively, the class of the runtime can be defined in the `extra.runtime.class`
entry of the `composer.json` file.
A `SymfonyRuntime` is used by default. It knows the conventions to run
Symfony and native PHP applications.
Examples
--------
This `public/index.php` is a "Hello World" that handles a "name" query parameter:
```php
<?php
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $request, array $context): void {
// $request holds keys "query", "body", "files" and "session",
// which map to $_GET, $_POST, $_FILES and &$_SESSION respectively
// $context maps to $_SERVER
$name = $request['query']['name'] ?? 'World';
$time = $context['REQUEST_TIME'];
echo sprintf('Hello %s, the current Unix timestamp is %s.', $name, $time);
};
```
This `bin/console.php` is a single-command "Hello World" application
(run `composer require symfony/console` before launching it):
```php
<?php
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (Command $command) {
$command->addArgument('name', null, 'Who should I greet?', 'World');
return $command->setCode(function (InputInterface $input, OutputInterface $output) {
$name = $input->getArgument('name');
$output->writeln(sprintf('Hello <comment>%s</>', $name));
});
};
```
The `SymfonyRuntime` can resolve and handle many types related to the
`symfony/http-foundation` and `symfony/console` components.
Check its source code for more information.
Commits
-------
61b32ab2a3 [Runtime] a new component to decouple applications from global state
This PR was merged into the 5.3-dev branch.
Discussion
----------
Don't use sprintf in trigger_deprecation() calls
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Old habits die hard :)
Commits
-------
9ba8f0567d Don't use sprintf in trigger_deprecation() calls
`ConstraintViolation#getMessageTemplate()`'s inherited signature states that `string` is
to be returned by it at all times, yet the implementation returns `null` when no message
template had been provided at instantiation.
This patch obviates it, returning an empty string when the
message template is `null`.
Ref: https://github.com/symfony/symfony/pull/40415#issuecomment-792839512
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Add support an integer return for default_index_method
| Q | A
| ------------- | ---
| Branch? | 5.x for features
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | #40319
| License | MIT
| Doc PR | TODO
Commits
-------
f0922c70d6 [DependencyInjection] Add support an integer return for default_index_method
This PR was merged into the 4.4 branch.
Discussion
----------
[Form] clear unchecked choice radio boxes even if clear missing is set to false
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#16802
| License | MIT
| Doc PR |
Commits
-------
e7b4851ea0 clear unchecked choice radio boxes even if clear missing is set to false
This PR was merged into the 5.3-dev branch.
Discussion
----------
[PropertyAccess] use bitwise flags to configure when the property accessor should throw
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | Fix#31126
| License | MIT
| Doc PR |
Commits
-------
a50cfcb49d use bitwise flags to configure when the property accessor should throw
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Cache] boost perf by wrapping keys validity checks with `assert()`
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
PSR-6 has one perf hog: checking the validity of keys.
But in practice, an invalid key should never happen in production: encoding/cleanup is a must-have, and it's a step that should be identified *during dev*.
That's why I think we're safe wrapping these checks with `assert()`.
On an `ArrayAdapter`, this doubles the throughput of the pool when getting items.
I didn't use `assert()` in constructors when not on the hot path.
This PR also makes some callable properties static, as they should be from the beginning.
Commits
-------
8f03a1f555 [Cache] boost perf by wrapping keys validity checks with `assert()`
Motivations for this change:
* Avoid an unneded preg call, explode+implode is faster
* The previous regex created to suboptimal expressions,
due to the pipe that caused empty to be matched.
That means an input like `foo:bar`
was translated into `foo[^:]*[^:]*:bar[^:]*[^:]*`
instead of simply `foo[^:]*:bar[^:]*`
`ConstraintViolation#getPropertyPath()`'s inherited signature states that `string` is
to be returned by it at all times, yet the implementation returns `null` when no property
path had been provided at instantiation.
This patch obviates it, returning an empty string when the
property path is `null`.
* 5.2:
[WebLink] Removed unused property
Fix method name compare in ResolveControllerNameSubscriber
add uz security validator and form validator file
uzb translation
* 4.4:
[WebLink] Removed unused property
Fix method name compare in ResolveControllerNameSubscriber
add uz security validator and form validator file
uzb translation
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Security] Decouple passwords from UserInterface
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | yes
| Tickets | #23081, helps with #39308
| License | MIT
| Doc PR | todo
This PR addresses a long-standing issue of the Security component: UserInterface is coupled to passwords.
It does it by moving the `getPassword()` method from `UserInterface` to a `PasswordAuthenticatedUserInterface`, and the `getSalt()` method to a `LegacyPasswordAuthenticatedUserInterface`.
Steps:
- In 5.3, we add the new interface and, at places where password-based authentication happens, trigger deprecation notices when a `UserInterface` object does not implement the new interface(s). The UserInterface is kept as-is until 6.0.
- In 6.0, we can remove the methods from `UserInterface` as well as support for using password authentication with user objects not implementing the new interface(s).
As a side-effect, some password-related interfaces (`UserPasswordHasherInterface` and `PasswordUpgraderInterface`) must change their signatures to type-hint against the new interface.
That is done in a BC way, which is to make the concerned methods virtual until 6.0, with deprecation notices triggered from callers and concrete implementations.
Benefits:
In 6.0, applications that use password-less authentication (e.g. login links) won't need to write no-op `getPassword()` and `getSalt()` in order to fulfil the `UserInterface` contract.
For applications that do use password-based authentication, they will need to opt-in explicitly by implementing the relevant interface(s).
This build on great discussions with @wouterj and @nicolas-grekas, and it is part of the overall rework of the Security component.
Commits
-------
2764225a38 [Security] Decouple passwords from UserInterface
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Notifier] [OvhCloud] Add "sender"
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features --> (I'm waiting to see if the feature is accepted )
Add "sender" option to the DSN that allows configuring the sender of the message.
OVHCloud manages two cases for sending sms according to the [doc](https://docs.ovh.com/fr/sms/envoyer_des_sms_avec_lapi_ovh_en_php/):
> The senderForResponse parameter will allow the use of a short number, which allows you to send SMS directly without having to create an alphanumeric sender (for example: your name).
> Short numbers also allow you to receive responses from the recipients of your SMS, which can be useful for a satisfaction survey, a voting application, a game, etc.
![CleanShot 2021-03-05 at 13 26 33](https://user-images.githubusercontent.com/523981/110115554-84c5af80-7db6-11eb-815d-7e8bafa81e5d.png)
This PR introduces the management of these 2 cases with a new option `sender`:
* if `sender` is set, we use it
* if `sender` is not set, we use `senderForResponse` to get a short number (current behavior)
I took the logic implementedin the old official SDK : 52d279e112/src/Message.php (L161)
Commits
-------
c5a9b252ab [Notifier] [OvhCloud] Add "sender"
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Implement psr/container 1.1
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
The `psr/container` interfaces have been updated with type declarations. The lack of those is what kept us from adding property type declarations to the `get()` and `has()` methods of our own `ContainerInterface`.
A small BC break is that we have never prevented calling code from passing `null` as the service ID. Even without strict types, this will cause a `TypeError` after my changes. I already had to update `AutowirePass` because of that.
On the other hand, it was neither documented that we allow `null` here nor did the container do anything useful (`has(null)` always resulted in `false` and `get(null)` always returned `null`).
Commits
-------
d9095aa892 [DependencyInjection] Implement psr/container 1.1
* 5.2:
Backport psr/container 1.1/2.0 compatibility
Update notifier_transports.php
Dont lock tables or start transactions
Bump Symfony version to 5.2.5
Update VERSION for 5.2.4
Update CHANGELOG for 5.2.4
Bump Symfony version to 4.4.21
Update VERSION for 4.4.20
Update CONTRIBUTORS for 4.4.20
Update CHANGELOG for 4.4.20
* 4.4:
Backport psr/container 1.1/2.0 compatibility
Bump Symfony version to 4.4.21
Update VERSION for 4.4.20
Update CONTRIBUTORS for 4.4.20
Update CHANGELOG for 4.4.20
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Security] Re-add accidentally removed property declarations
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
spotted while playing with psalm locally, mistake made in #39802
Commits
-------
bccf736b99 [Security] Readd accidentally removed property declarations
This PR was squashed before being merged into the 5.2 branch.
Discussion
----------
[Messenger] Doctrine setup with migrations
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? |
| Deprecations? | no
| Tickets | Fix#40130
| License | MIT
| Doc PR |
This PR reverts parts of #40055.
When running these commands, You do need to be in a transaction:
- `doctrine:schema:create`
- `messenger:setup-transports`
- `doctrine:migrations:diff` and `doctrine:migrations:migrate`
Commits
-------
3371e1cf39 [Messenger] Doctrine setup with migrations
This PR was merged into the 4.4 branch.
Discussion
----------
Add missing translations for Belarusian
| 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 | Fix#38727 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | N/A <!-- required for new features -->
Add translations for Belarusian
Commits
-------
1b84d5d23b Add translation for Belarusian
8e1d3285ed Adding templates for Belarusian
This PR was merged into the 4.4 branch.
Discussion
----------
[Serializer] zero parts can be omitted in date interval input
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35820
| License | MIT
| Doc PR |
Commits
-------
c316708669 zero parts can be omitted in date interval input
This PR was merged into the 4.4 branch.
Discussion
----------
MockResponse total_time should not be simulated when provided
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
When you provide a `total_time` to a MockResponse, it is overriden. It should be simulated only when it is not provided I guess.
Ex: `new MockResponse('{"foo":"bar"}', ['total_time' => 0.4])`
Commits
-------
8dada95cbf fix: MockResponse total_time should not be simulated when provided
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Messenger] Add `rediss://` DSN scheme support for TLS to Redis transport
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets |
| License | MIT
| Doc PR |
This adds a support for `rediss://` DSN (as discussed in https://github.com/symfony/symfony/pull/39599) and deprecates the use of `tls` parameter introduced in https://github.com/symfony/symfony/pull/35503 so it can be standardized to single format.
Commits
-------
28e7b74b47 [Messenger] Add `rediss://` DSN scheme support for TLS to Redis transport
This PR was merged into the 4.4 branch.
Discussion
----------
[Cache] Add server-commands support for Predis Replication Environments
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#35867
| License | MIT
| Doc PR |
This fix is for predis MasterSlaveConnections which don't allow to run server commands.
Due to that it's not possible to e.g. clear a cache with cache:pool:clear.
PhpRedis and Predis do not have the same interface, so have to check which implementation is used.
Furthermore, the getClientFor('master') works only for replicated redis instances.
Commits
-------
2ae5c33c80 [Cache] Add server-commands support for Predis Replication Environments
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
Fix deprecation messages
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | yes
| Tickets | -
| License | MIT
| Doc PR | -
The wrong namespace is used in the deprecation messages
Commits
-------
4aca3edb9e Fix deprecation messages
This PR was merged into the 5.3-dev branch.
Discussion
----------
[HttpClient] Add `HttpClientInterface::withOptions()`
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
I've been thinking about this method for a few months already.
We miss a way to configure an HTTP client in a generic way.
This is useful when eg building an API client as this allows configuring default options once for a consumer, eg in the constructor.
```php
$this->client = $client->withOptions(['base_uri' => 'https://...']);
// [...]
$response = $this->client->request('GET', '/relative-url');
```
Commits
-------
439742ff33 [HttpClient] Add `HttpClientInterface::withOptions()`
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpKernel] Configure `session.cookie_secure` earlier
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#40221
| License | MIT
| Doc PR | N/A
This PR does what @stof had suggested in #40221, allow me to quote him directly:
> 1. avoid setting auto as a value for the ini setting in the NativeSessionStorage initialization
> 2. ensuring that SessionListener resolves the auto value by the time the SessionListener runs, and not by the time the getSession() method is called in the Request session factory callback
Commits
-------
e82918cd60 [HttpKernel] Configure `session.cookie_secure` earlier
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Uid] Add Generate and Inspect commands
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
After some time using the component, I realized I often needed to quickly generate new ulids or to convert them from one format to another so I thought having those commands would be useful.
# Usage
## Generate a ULID - outputs N ULID(s) separated by new lines in base 32, base 58 or RFC 4122 format
### Generate 1 ULID now
`php bin/console ulid:generate`
### Generate 1 ULID with a specific timestamp
`php bin/console ulid:generate --time="2021-02-02 14:00:00"`
### Generate 2 ULIDs and ouput the RFC4122 format
`php bin/console ulid:generate --count=2 --format=rfc4122`
## Generate a UUID - outputs N UUID(s) separated by new lines in RFC 4122, base 58 or base 32 format
### Generate 1 UUID (defaults from the underlying factory)
`php bin/console uuid:generate`
### Generate 1 time-based UUID now
`php bin/console uuid:generate --time-based=now`
### Generate 1 time-based UUID with a specific timestamp
`php bin/console uuid:generate --time-based="2021-02-02 14:00:00"`
### Generate 1 time-based UUID with a specific node
`php bin/console uuid:generate --time-based=now --node=fb3502dc-137e-4849-8886-ac90d07f64a7`
### Generate 1 name-based UUID (there must be a default namespace in the underlying factory)
`php bin/console uuid:generate --name-based=foo`
### Generate 1 name-based UUID with a specific namespace (overrides the default namespace from the underlying factory)
`php bin/console uuid:generate --name-based=foo --namespace=fb3502dc-137e-4849-8886-ac90d07f64a7`
### Generate 1 random-based UUID
`php bin/console uuid:generate --random-based`
### Generate 2 UUIDs and output their base 58 format
`php bin/console uuid:generate --count=2 --format=base58`
## Inspect a ULID - outputs base32, base58 and RFC 4122 formats of a ULID and its humand readable timestamp if it is time-based
`php bin/console ulid:inspect 01EWAKBCMWQ2C94EXNN60ZBS0Q`
`php bin/console ulid:inspect 1BVdfLn3ERmbjYBLCdaaLW`
`php bin/console ulid:inspect 01771535-b29c-b898-923b-b5a981f5e417`
## Inspect a UUID - outputs RFC 4122, base 58 and base 32 formats of a UUID and its human readable timestamp
`php bin/console uuid:inspect a7613e0a-5986-11eb-a861-2bf05af69e52`
`php bin/console uuid:inspect MfnmaUvvQ1h8B14vTwt6dX`
`php bin/console uuid:inspect 57C4Z0MPC627NTGR9BY1DFD7JJ`
# Register the commands
## YAML
```yaml
# services.yaml
services:
Symfony\Component\Uid\Command\GenerateUlidCommand: ~
Symfony\Component\Uid\Command\GenerateUuidCommand: ~
Symfony\Component\Uid\Command\InspectUlidCommand: ~
Symfony\Component\Uid\Command\InspectUuidCommand: ~
```
## PHP
```php
<?php
// services.php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\Uid\Command\GenerateUlidCommand;
use Symfony\Component\Uid\Command\GenerateUuidCommand;
use Symfony\Component\Uid\Command\InspectUlidCommand;
use Symfony\Component\Uid\Command\InspectUuidCommand;
return static function (ContainerConfigurator $configurator): void {
$services = $configurator->services()
->defaults()
->autowire()
->autoconfigure();
$services
->set(GenerateUlidCommand::class)
->set(GenerateUuidCommand::class)
->set(InspectUlidCommand::class)
->set(InspectUuidCommand::class);
};
```
Commits
-------
223421b6ca [Uid] Add Generate and Inspect commands
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#40136, fix#39356
| License | MIT
| Doc PR | no need to
Leverages https://github.com/composer/composer/pull/9682 to ignore dev-packages when configuring the container.
Commits
-------
47c471e2c4 [DependencyInjection] Add ContainerBuilder::willBeAvailable() to help with conditional configuration
* 5.2:
[TwigBridge] Install symfony/intl to run tests on Travis
[Translation] Make `name` attribute optional in xliff2
[Security] #[CurrentUser] argument should resolve to null when it is anonymous
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Routing] Construct Route annotations using named arguments
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | N/A
| License | MIT
| Doc PR | Not needed
This PR proposes to bump the `doctrine/annotations` library to 1.12 to gain access to its emulation layer for named arguments. Furthermore, constructing a `Route` annotation the old way by passing an array of parameters is deprecated.
### Reasons for this change
The constructors of our annotation classes have become unnecessarily complicated because we have to support two ways of calling them:
* An array of parameters, passed as first argument, because that's the default behavior `doctrine/annotations`.
* A set of named arguments because that's how PHP 8 attributes work.
Since we can now tell the Doctrine annotation reader to use named arguments as well, we can simplify the constructors of our annotations significantly.
### Drawback
After this change, there is no easy way anymore to construct instances of the `Route` annotation class directly on PHP 7. The PR has been built under the assumption that instances of this class are usually created using either Doctrine annotations or a PHP 8 attribute. Thus, most applications should be unaffected by this change.
Commits
-------
29b0f96046 [Routing] Construct Route annotations using named arguments
This PR was merged into the 5.3-dev branch.
Discussion
----------
Deprecate passing null as $message or $code to exceptions
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | N/A
| License | MIT
| Doc PR | N/A
Follow-up to #40271.
Following the example of the PHP core, this PR introduces deprecation warnings that are triggered if a developer attempts to pass null as `$code` or `$message` to an exception constructor.
Commits
-------
8e3058d95a Deprecate passing null as $message or $code to exceptions
This PR was merged into the 5.2 branch.
Discussion
----------
[Security] #[CurrentUser] arguments should resolve to null for "anon."
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
The UserValueResolver should only resolve `UserInterface` (or subtype) typed arguments:
bc9e946a56/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php (L54-L55)
When using the `#CurrentUser` attribute with an AnonymousToken in the storage, the resolved argument value is `anon.`. This PR fixes it.
/cc @jvasseur
Commits
-------
8d3078dd35 [Security] #[CurrentUser] argument should resolve to null when it is anonymous
* 5.2:
Move github templates at the org level
[Cache] Fix Redis TLS scheme `rediss` for Redis connection
In calls to mb_ functions, silently transform arg into string
Switched to non-null defaults in exception constructors
[Routing] fix conflict with param named class in attribute
[Cache] fix setting items' metadata on commit()
* 4.4:
Move github templates at the org level
[Cache] Fix Redis TLS scheme `rediss` for Redis connection
In calls to mb_ functions, silently transform arg into string
This PR was merged into the 4.4 branch.
Discussion
----------
[Console] Handle calls to mb_ functions with non string arguments
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#40200
| License | MIT
| Doc PR | no
In PHP8.1, a number of functions who were accepting null arguments will only accept
string ones.
(see https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg)
In the polyfill, mb_* functions are already declared with a strict type checking of "string".
Therefore, it is necessary to get rid of the use of non string arguments when calling mb_* functions,
so that it won't break when either using the polyfill,or future php8 versions.
In every call where the argument may not be a string, this commit enforces the string type of the argument (with transtyping)
--- For reviewers
* I generally don't like transtyping, but found it was the more "secure" way (on a non-BC point of view) here.
Specially in Console/Helper/Table.php, where $cell can be an object (there are 2 "$cell instanceof ... tests)
However, where the argument can already be either null or string (and not anything else), there may a beter approach ?
* It's the first time I send a PR on symfony, so don't hesitate pointing me to thinks I've forgotten to done.
Commits
-------
ac45be2580 In calls to mb_ functions, silently transform arg into string
In PHP8, a number of functions who were accepting null arguments will only accept
string ones.
In the polyfill, mb_* functions are declared with a trict type checking of "string".
Therefore, we deprecate the use of non string arguments, so that it won't break when either using the polyfill,
or future php8 versions.
* 4.4:
Switched to non-null defaults in exception constructors
[Routing] fix conflict with param named class in attribute
[Cache] fix setting items' metadata on commit()
This PR was merged into the 4.4 branch.
Discussion
----------
Switched to non-null defaults in exception constructors
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
PHP 8.1 will trigger a deprecation warning if we pass `null` as `$message` or `$code` to the constructor of `\Exception`. However, many of our own exception accept `null` for those parameters and even use them as default.
This is unfortunate because code like the following snippet would trigger that deprecation although the code itself is perfectly fine:
```php
throw new NotFoundHttpException();
```
With this PR, I'd like to change our defaults to `''` and `0` while still allowing to pass `null` for BC. In a follow-up PR for the 5.x branch, I'd like to deprecate passing `null`, matching the future behavior of PHP.
This PR also adjust various PHPDoc blocks with inaccurate types.
Commits
-------
f8e10094a4 Switched to non-null defaults in exception constructors
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Routing] fix conflict with param named class in attribute
| Q | A
| ------------- | ---
| Branch | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#40225
| License | MIT
| Doc PR | -
Fix conflict with AnnotationFileLoader and class PHP8 Attribute with param named "class"
Commits
-------
27bba684d8 [Routing] fix conflict with param named class in attribute
This PR was merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle] allow container/routing configurators to vary by env
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | #40215
| License | MIT
| Doc PR | -
Inspired by https://github.com/symfony/webpack-encore/pull/900 and by a chat on Slack with @weaverryan
This aims at allowing conditional configuration, which would allow merging config files in one.
Using the PHP-DSL:
```php
$container
->when(env: 'prod')
->services()
->set(Foo::class)
//...
```
In Yaml:
```yaml
framework:
secret: '%env(APP_SECRET)%'
when@dev:
services:
App\FooForDev: ~
when@test:
framework:
test: true
session:
storage_factory_id: session.storage.mock_file
```
In XML (omitting namespaces):
```xml
<when env="test">
<framework test="true">
<!-- ... -->
</framework>
</when>
```
A similar syntax is also provided for routes, with support for annotations:
`@Route(env="prod")` defines a route that is enabled only on the "prod" env.
Commits
-------
108375b068 [FrameworkBundle] allow container/routing configurators to vary by env
* 5.2:
[Form] Ignoring invalid forms from delete_empty behavior in CollectionType
Add Symfony Armenian Translations
cs fix
Add different header notations to tests
* 4.4:
[Form] Ignoring invalid forms from delete_empty behavior in CollectionType
Add Symfony Armenian Translations
cs fix
Add different header notations to tests
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Form] Ignoring invalid forms from delete_empty behavior in CollectionType
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37660
| License | MIT
| Doc PR | -
As expained on linked issue, empty forms cannot be removed if they are invalid upon submitting (e.g. transformation failures). Thus, form errors can be displayed properly to the end user.
Commits
-------
e4911554e3 [Form] Ignoring invalid forms from delete_empty behavior in CollectionType
This PR was merged into the 4.4 branch.
Discussion
----------
Add Symfony Armenian Translations
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix#40204
| License | MIT
| Doc PR |
Added missing armenian translations for Form components
Commits
-------
d1c3e21eff Add Symfony Armenian Translations
This PR was merged into the 4.4 branch.
Discussion
----------
[BrowserKit] Add different header notations to tests
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix#29736
| License | MIT
| Doc PR | -
In the past there was a issue #29736 that the header wasn't processed correctly. To reproduce and prevent this behaviour i extended the tests for this. At the end everything is fine, also in 5.x branch. See bf03d6889d.
Commits
-------
251ce8f924 Add different header notations to tests
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Console] Add `ConsoleCommand` attribute for declaring commands on PHP 8
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Builds on #39851
On PHP8, this PR will allow using an attribute instead of the public static properties for the name and the description.
```php
#[ConsoleCommand(
name: 'app:my-command',
description: '🌈',
hidden: true,
aliases: ['🌈'],
)]
class MyCommand extends Command
{
}
```
Commits
-------
0cbc9cc672 [Console] Add `ConsoleCommand` attribute for declaring commands on PHP 8
* 5.2:
Stop using deprecated ArrayCache from Doctrine
[EventDispatcher] fix registering subscribers twice on edge-case
[Intl] fix Locale::getFallback() throwing exception on long $locale
* 5.2:
install compatible versions of mongodb/mongodb only
fix taking error message from the correct violation
fix resolving parent/self/static type annotations
[Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name
[WebLink] Escape double quotes in attributes values
[String] Check if function exists before declaring it
* 4.4:
install compatible versions of mongodb/mongodb only
fix resolving parent/self/static type annotations
[Console] fix QuestionHelper::getHiddenResponse() not working with space in project directory name
[WebLink] Escape double quotes in attributes values
This PR was merged into the 4.4 branch.
Discussion
----------
[PropertyInfo] fix resolving self to name of the analyzed class
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37149
| License | MIT
| Doc PR |
Commits
-------
e9f2ece991 fix resolving parent/self/static type annotations
This PR was merged into the 4.4 branch.
Discussion
----------
[WebLink] Escape double quotes in attributes values
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
If the attribute value contains a double quote, the serialized value is invalid: `</foo>; rel="alternate"; title="foo " bar"`. Ideally we would use `addcslashes` but we can't because users that already pass escaped values would then be impacted.
Commits
-------
7946be2b95 [WebLink] Escape double quotes in attributes values
This PR was squashed before being merged into the 5.2 branch.
Discussion
----------
[String] Check if function exists before declaring it
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
If you installed a command line tool like `psalm` with composer and then try to run it on a project that included the String component you will get an error like:
> Fatal error: Cannot redeclare Symfony\Component\String\u() (previously declared in /Workspace/symfony/src/Symfony/Component/String/Resources/functions.php:14) in /user/.composer/vendor/symfony/string/Resources/functions.php on line 14
That is because we are loading two installations of the string component.
Commits
-------
cc00e0eb78 [String] Check if function exists before declaring it
This PR was merged into the 5.3-dev branch.
Discussion
----------
[DependencyInjection] Add `#[Autoconfigure]` to help define autoconfiguration rules
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Being inspired by the discussion with @derrabus in #39776.
This PR allows declaring autoconfiguration rules using an attribute on classes/interfaces, eg:
`#[Autoconfigure(bind: ['$foo' => 'bar'], tags: [...], calls: [...])]`
This should typically be added on a base class/interface to tell *how* implementations of such a base type should be autoconfigured. The attribute is parsed when autoconfiguration is enabled, except when a definition has the `container.ignore_attributes` tag, which allows opting out from this behavior.
As usual, the corresponding rules are applied only to services that have autoconfiguration enabled.
In practice, this means that this enables auto-tagging of all implementations of this interface:
```php
#[Autoconfigure(tags: ['my_tag'])]
interface MyInterface {...}
```
Of course, all auto-configurable settings are handled (calls, bindings, etc.)
This PR adds another attribute: `#[AutoconfigureTag()]`.
It extends `#[Autoconfigure]` and allows for specifically defining tags to attach by autoconfiguration.
The name of the tag is optional and defaults to the name of the tagged type (typically the FQCN of an interface). This should ease with writing locators/iterators of tagged services.
```php
#[AutoconfigureTag()]
interface MyInterface {...}
```
Commits
-------
64ab6a2850 [DependencyInjection] Add `#[Autoconfigure]` to help define autoconfiguration rules
* 5.2:
Ignore indirect deprecation triggered by doctrine/orm
Symfony Armenian Translations
[Translation] Allow using dashes in locale when linting Xliff files
use the right context for properties defined in traits
* 4.4:
Ignore indirect deprecation triggered by doctrine/orm
Symfony Armenian Translations
[Translation] Allow using dashes in locale when linting Xliff files
use the right context for properties defined in traits
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Mailer] AWS SES transport Source ARN header support
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | need help (this part was never mentioned in docs)
AWS SES API has [FromEmailAddressIdentityArn](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html#SES-SendEmail-request-FromEmailAddressIdentityArn) field which is necessary for using identities verified by different AWS account.
With this PR I am adding ability to set this field via setting `X-SES-SOURCE-ARN` header.
I've added support for this API field in the same way as it was done before for `X-SES-CONFIGURATION-SET`. It was never documented, but you can use header `X-SES-CONFIGURATION-SET` to set `ConfigurationSetName` API param.
Commits
-------
d7225db7d5 [Mailer] AWS SES transport Source ARN header support
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Framework] Add tag assets.package to register asset packages
Replaces #38366
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | symfony/symfony-docs#14962
To configure asset packages in an application, we have to declare it in the `framework` configuration ([doc for assets config](https://symfony.com/doc/current/reference/configuration/framework.html#assets)). In some case we cannot use this configuration:
- To use a custom class as package
- To register an asset package in a shared bundle (my use-case).
This PR adds the `assets.package` tag. This tag is use to collect and inject package services into the `assets.packages` service, that is the registry for all packages. Since every package needs a name, the `package` attribute of the tag is used (same naming convention that the `console.command` tag).
Main changes:
- the packages defined in the `framework.assets` configuration are injected into the `assets.packages` using the tag instead of being directly injected in service declaration.
- changed signature of `Symfony\Components\Assets\Packages` constructor to accept an iterator (backward compatible).
- a new alias `assets._default_package` is defined even if assets are not configured.
### Example in `symfony/demo` ([commit](e5e5a8fff0...GromNaN:assets-package-tag)):
In `config/services.yaml`:
```yaml
avatar.strategy:
class: Symfony\Component\Asset\VersionStrategy\JsonManifestVersionStrategy
arguments:
- '%kernel.project_dir%/public/build/manifest.json'
avatar.package:
class: Symfony\Component\Asset\Package
arguments:
- '@avatar.strategy'
- '@assets.context'
tags:
- { name: assets.package, package: avatars }
```
Then we can use the package anywhere
```twig
<img src="{{ asset('anna.jpg', 'avatars') }}">
```
### Alternative using autoconfiguration with a custom class:
With a custom class implementing the `PackageInterface`, the package name can be provided by a the static method `getDefaultPackageName`. Autowiring and autoconfiguration will import the package.
```php
namespace App\Asset;
use Symfony\Component\Asset\PackageInterface;
class AvatarPackage implements PackageInterface
{
public static function getDefaultPackageName(): string
{
return 'avatars';
}
// ... Implements the interface
}
```
Commits
-------
6217ff7b6f [Asset] Add tag assets.package to register asset packages
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Serializer] Allow to provide (de)normalization context in mapping
| Q | A
| ------------- | ---
| Branch? | 5.x
| 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#39039 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | TODO <!-- required for new features -->
As explained in the linked feature request, this brings the ability to configure context on a per-property basis, using Serializer mapping.
Considering:
```php
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
class Foo
{
/**
* @Serializer\Context({ DateTimeNormalizer::FORMAT_KEY = 'Y-m-d' })
*/
public \DateTime $date;
public \DateTime $anotherDate;
}
```
`$date` will be formatted with a specific format, while `$anotherDate` will use the default configured one (or the one provided in the context while calling `->serialize()` / `->normalize()`).
It can also differentiate normalization and denormalization contexts:
```php
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
class Foo
{
/**
* @Serializer\Context(
* normalizationContext = { DateTimeNormalizer::FORMAT_KEY = 'Y-m-d' },
* denormalizationContext = { DateTimeNormalizer::FORMAT_KEY = \DateTime::COOKIE },
* )
*/
public \DateTime $date;
}
```
As well as act differently depending on groups:
```php
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
class Foo
{
/**
* @Serializer\Groups({ "extended" })
* @Serializer\Context({ DateTimeNormalizer::FORMAT_KEY = \DateTime::RFC3339 })
* @Serializer\Context(
* context = { DateTimeNormalizer::FORMAT_KEY = \DateTime::RFC3339_EXTENDED },
* groups = {"extended"},
* )
*/
public \DateTime $date;
}
```
The annotation can be repeated as much as you want to handle the different cases.
Context without groups is always applied first, then context for groups are merged in the provided order.
Context provided when calling `->serialize()` / `->normalize()` acts as the defaults for the properties without context provided in the metadata.
XML mapping (see tests) is a lot verbose due to the required structure to handle groups.
Such metadata contexts are also forwarded to name converters, max depth handlers, callbacks, ...
Of course, PHP 8 attributes are also supported:
```php
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
class Foo
{
#[Serializer\Groups(["extended"])]
#[Serializer\Context([DateTimeNormalizer::FORMAT_KEY => \DateTime::RFC3339])]
#[Serializer\Context(
context: [DateTimeNormalizer::FORMAT_KEY => \DateTime::RFC3339_EXTENDED],
groups: ["extended"],
)]
public \DateTime $date;
}
```
The PR should be ready for first batch of reviews / discussions.
- [x] Make Fabbot happy in 5.2
- [x] Missing `@Context` unit tests
- [x] rework xml & phpize values
- [x] Fix lowest build issue with annotations => bumped doctrine annotations to 1.7, as for other components
Commits
-------
7229fa1d8f [Serializer] Allow to provide (de)normalization context in mapping
This PR was merged into the 4.4 branch.
Discussion
----------
[PropertyInfo] use the right context for properties defined in traits
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#28732, #34191
| License | MIT
| Doc PR |
Commits
-------
1572491a8a use the right context for properties defined in traits
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Translation] Allow using dashes in locale when linting Xliff files
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | fixes#40170
| License | MIT
| Doc PR | n/a
This pull request
* [x] asserts that the `XliffLintCommand` succeeds linting an Xliff file where both the the target language and the locale in the file name use dashes as separators
* [x] adjusts the `XliffLintCommand` to allow using the same value for target language and locale in the corresponding file name
Commits
-------
d106aa3f2d [Translation] Allow using dashes in locale when linting Xliff files
* 5.2:
[Workflow] Re-add InvalidTokenConfigurationException for BC
Fix PHP 8.1 null values
[Console] Fix PHP 8.1 null error for preg_match flag
Fix: Article
Definition::removeMethodCall should remove all matching calls
[HttpFoundation] Fix typo in exception message
mark the LazyIterator class as internal
fix extracting mixed type-hinted property types
[Worflow] Fixed GuardListener when using the new Security system
keep valid submitted choices when additional choices are submitted
* 4.4:
Fix PHP 8.1 null values
[Console] Fix PHP 8.1 null error for preg_match flag
Fix: Article
Definition::removeMethodCall should remove all matching calls
mark the LazyIterator class as internal
fix extracting mixed type-hinted property types
keep valid submitted choices when additional choices are submitted
This PR was merged into the 5.2 branch.
Discussion
----------
[Worflow] Fixed GuardListener when using the new Security system
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#39505
| License | MIT
| Doc PR |
Commits
-------
bd26a79461 [Worflow] Fixed GuardListener when using the new Security system
This PR was merged into the 4.4 branch.
Discussion
----------
Fix: Article
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | n/a
This pull request
* [x] fixes usages of the indefinite article `a` where `an` should be used instead
Commits
-------
34b320ba97 Fix: Article
This PR was merged into the 4.4 branch.
Discussion
----------
[Console] Fix PHP 8.1 null error for preg_match flag
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Since PHP 8.1, `null` is no longer accepted as `$flags` in `preg_match`, default integer `0` value should be used instead.
Commits
-------
52f02e529a [Console] Fix PHP 8.1 null error for preg_match flag
This PR was merged into the 5.3-dev branch.
Discussion
----------
[PasswordHasher] Fix: Use algorithm instead of algo
| Q | A
| ------------- | ---
| Branch? | 5.5
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | n/a
This pull request
* [x] renames fields, variables, and parameters using `algos` or `algo` (which appear to be entirely made-up words) to `algorithms` and `algorithm` respectively
Commits
-------
a4dd14b478 Fix: Use algorithm instead of algo
This PR was merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle] Deprecate session.storage service
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | yes
| Tickets | -
| License | MIT
| Doc PR | TODO
Following the deprecation of `session` service, this PR deprecate other services that contains state: `session.storage`
- `session.storage`
- `session.storage.native`, `session.storage.php_bridge` and `session.storage.mock_file`
- `session.storage.metadata_bag`
Because people can inject / decorate override all these services, providing a migration path like I did with `session` would have been very hard. That's why, I added a new `opt-in` flag:
When people use `framework.session: true` or `framework.session.storage_id` the previous behavior is kept and deprecation are triggered when accessing the services.
But when people use the new `framework.session.storage_factory_id` configuration, the previous services (`session.storage.*`) are deleted (in case people would try to inject the legacy `session.storage*` services and would have expect to manipulate the same objects as the object injected in the session)
Commits
-------
37c591516a Deprecate session.storage
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Security] Extract password hashing from security-core - with proper wording
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fixes#39698
| License | MIT
| Doc PR | todo
This PR renames password "encoders" to password _hashers_ (naming widely used, see e.g. django or laravel).
This also takes the opportunity to extract the logic related to password hashing from security-core, moving it to a new password-hasher component.
Nowadays, many modern web apps and APIs don't deal with passwords at all, that's why splitting makes sense as a step towards making security-core not tied to the password concept.
For upgrading, applications will have to use `passwords_hashers` instead of `encoders` in their security configuration, and type-hint against `PasswordHasherInterface` (and related) instead of `PasswordEncoderInterface`.
The proposed API is not much different from the encoder one regarding behavior and signatures, and it is slightly more close to the PHP built-in password hashing API:
```php
namespace Symfony\Component\PasswordHasher;
interface PasswordHasherInterface
{
public function hash(string $plainPassword): string;
public function verify(string $hashedPassword, string $plainPassword): bool;
public function needsRehash(string $hashedPassword): bool;
}
```
Commits
-------
c5c981c559 [Security] Extract password hashing from security-core - using the right naming
* 5.2:
add missing return type declaration
Modernize func_get_args() calls to variadic parameters
Use a lazyintertor to close files descriptors when no longer used
* 4.4:
add missing return type declaration
Modernize func_get_args() calls to variadic parameters
Use a lazyintertor to close files descriptors when no longer used
This PR was merged into the 4.4 branch.
Discussion
----------
[Finder] Use a lazyIterator to close files descriptors when no longer used
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | fix#35508
| License | MIT
| Doc PR | -
The `RecursiveDirectoryIterator` class open the file on `__construct`.
Because we Inject an instance of `RecursiveDirectoryIterator` inside the \AppendIterator` class, php opens a lot of file even before iterating on it.
This PR adds a new `LazyIterator` class that instantiate the decorated class only when something starts iterating on it.
When the iteration is over, it unset the variable to close let the decorated class clean things (ie. close the files)
Commits
-------
7117e1a798 Use a lazyintertor to close files descriptors when no longer used
This PR was merged into the 5.3-dev branch.
Discussion
----------
[HttpFoundation] Fix consistency in sessions not found exceptions
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#40112
| License | MIT
| Doc PR | -
Make `Request::getSession` thrown a `SessionNotFoundException` and make `SessionNotFoundException` extends `\BadMethodCallException` for backward compatibility and
Commits
-------
7fcb76d367 Fix consistency in sessions not found exceptions
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Filesystem] Remove dirs atomically if possible
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix#27578
| License | MIT
| Doc PR | no need to
Commits
-------
17bccca9c6 [Filesystem] remove dirs atomically if possible
This PR was merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle][Messenger] Added RouterContextMiddleware
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | TODO
When handling a message in async, we, sometimes need the Router Context to generate absolute URL. ie:
- sending an email when the message contains only the template
- generating a PDF
People can use the configuration `router.default_uri` to workaround and fix the issue, but this does not work when the web application servers several domains.
This PR provide a new middleware that store the current router context in a stamp, and restore the context when processing the message.
Commits
-------
8fe8b96921 [Messenger] Added RouterContextMiddleware
This PR was squashed before being merged into the 5.2 branch.
Discussion
----------
[RateLimiter] Fix sliding_window misbehaving with stale records
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Currently the SlidingWindow RateLimiter returns a negative value for getHitCount if the previous SlidingWindow was too long ago. This results in a really high value from `SlidingWindowLimiter::getAvailableTokens()` which is higher than the configured limit.
This limits the value of percentOfCurrentTimeframe in `SlidingWindow::getHitCount()` to 1 so it can't result in a negative hitcount.
The 2nd fix fixes the SlidingWindow instance (essentially) not storing hits if the previous instance is way in the past, as the next instance will still be "in the past". This causes RateLimit to behave as if it were disabled until it has caught up again, which could take a long time when it is configured with a small window size.
Commits
-------
57033164c6 [RateLimiter] Fix sliding_window misbehaving with stale records
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Notifier] [Firebase] Add data field to options
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | https://github.com/symfony/symfony/issues/40078
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
The Firebase Notifier must comply to the specifications at https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref.html#notification-payload-support .
The options are missing the `data` field which is a common field for all types of notifications: web, ios and android.
Commits
-------
fa8064bbd3 [Notifier] [Firebase] Add data field to options
* 5.2:
[HttpKernel] fix transient test
[FrameworkBundle] Fix freshness checks with boolean parameters on routes
forward the label_html option to expanded choice fields
[FrameworkBundle] fix registering "annotations.cache" on the "container.hot_path"
Add some information about the username in CONTRIBUTORS
* 4.4:
[HttpKernel] fix transient test
[FrameworkBundle] Fix freshness checks with boolean parameters on routes
[FrameworkBundle] fix registering "annotations.cache" on the "container.hot_path"
Add some information about the username in CONTRIBUTORS
* 5.2:
merge translation parameters with value configured for parent form
scan directories for translations sequentially
Fix kafka tests
Fix "provide" declarations
Provide implemented packages of replaced dependencies
Always autoload string functions on symfony/symfony
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpKernel] [Kernel] Silence failed deprecations logs writes
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
When `->buildContainer()` throws because the cache directory cannot be created, we still try to write the deprecations logs inside the cache directory. In this case, the final exception is `Warning: file_put_contents(/app/var/cache/dev/App_KernelDevDebugContainerDeprecations.log): failed to open stream: No such file or directory` instead of `Unable to create the "cache" directory (/app/var/cache/dev).`.
Alternative:
```php
try {
// ...
} catch (\RuntimeException $e)
} finally {
if (isset($e)) {
throw $e;
}
// ...
}
```
Commits
-------
b7100b6909 [HttpKernel] [Kernel] Silence deprecations logs writes
This PR was merged into the 4.4 branch.
Discussion
----------
Allow psr/cache v3 but on symfony/cache
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Consumers of PSR-6 are compatible with v1|2|3.
Implementations aren't until they add explicit return types, which is not possible without a BC break.
Commits
-------
bf23c44a07 Allow psr/cache v3 but on symfony/cache