Skip to content

Add extension requirements #60386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 801 commits into from
Closed

Add extension requirements #60386

wants to merge 801 commits into from

Conversation

afilina
Copy link
Contributor

@afilina afilina commented May 8, 2025

Q A
Branch? 7.2
Bug fix? yes
New feature? no
Deprecations? no
Issues see below
License MIT

When running composer install, instead of warning of the missing extensions, it crashes in PHP code, forcing us to search online for results.

nicolas-grekas and others added 30 commits March 21, 2025 18:34
…(lyrixx)

This PR was merged into the 7.3 branch.

Discussion
----------

[FrameworkBundle] Make `ServicesResetter` autowirable

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        |
| License       | MIT

I need this service quite often, and I never made this PR...
But Today I'm motivated 😃

Commits
-------

eb70c8b [FrameworkBundle] Add alias `ServicesResetter` for `services_resetter` service
…essor` (lyrixx)

This PR was merged into the 7.3 branch.

Discussion
----------

[MonologBridge] Implement `ResettableInterface` on `Processor`

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | not really
| Deprecations? | no
| Issues        |
| License       | MIT

See https://github.com/Seldaek/monolog/blob/2b8777dfb48a01321fa1532254f7603a6d4ceebe/src/Monolog/Logger.php#L449

Sometimes, you don't want to reset the whole application, but just a logger

Commits
-------

a595774 [MonologBridge] Implements ResettableInterface on Processor
…nfiguration callbacks on the same class (GromNaN)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[DependencyInjection] Enable multiple attribute autoconfiguration callbacks on the same class

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | yes
| Deprecations? | yes
| Issues        | Fix doctrine/DoctrineBundle#1868 (comment)
| License       | MIT

Replace #60001

By having a list of callables for each attributes, we can enable merging definitions each having an autoconfiguration for the same attribute class. This is the case with the `#[Entity]` attribute in DoctrineBundle and FrameworkBundle.

I have to deprecate `ContainerBuilder::getAutoconfiguredAttributes()` as its return type is `array<class-string, callable>`; so I added a new method `AttributeAutoconfigurationPass` that returns `array<class-string, callable[]>` in  in order to use reflection on each callable in the compiler pass.

Commits
-------

e36fe60 [DependencyInjection] Enable multiple attribute autoconfiguration callbacks on the same class
…tion < 7.3 (xabbuh)

This PR was merged into the 7.3 branch.

Discussion
----------

[FrameworkBundle] fix compatibility with DependencyInjection < 7.3

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

Commits
-------

c2523f6 fix compatibility with DependencyInjection < 7.3
…sure based checks (arjenm)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[Config] Make ifFalse() consistent between value and closure based checks

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix  #59325
| License       | MIT

I noticed the Config/ExpBuilder got a nice new ifFalse in Symfony 7.3.
But I think its implementation is confusing.

The behavior for `ifTrue()` was:
- If no closure is provided: if the actual value is `true` execute the then part
- If a closure is provided: if it returns `true` execute the then part

The behavior for `ifFalse()` is prior to this PR is:
- If no closure is provided: if the actual value is `false` execute the then part
- If a closure is provided: if it returns **`true`** execute the then part

With this PR it becomes:
- If no closure is provided: if the actual value is `false` execute the then part
- If a closure is provided: if it returns **`false`** execute the then part

Rationale, I think people (me included) would not expect these to be both be valid or invalid with the same input:
`$expr->ifTrue(self::valueIsNotValid(...))->thenInvalid()`
`$expr->ifFalse(self::valueIsNotValid(...))->thenInvalid()`

They/I expect to have to change it to a test for valid values (rather than invalid ones):
`$expr->ifFalse(self::valueIsValid(...))->thenInvalid()`

Commits
-------

335bdbe [Config] Make ifFalse() consistent between value and closure based checks
… to set type aliases (NanoSector)

This PR was merged into the 7.3 branch.

Discussion
----------

[DoctrineBridge] Add argument to `EntityValueResolver` to set type aliases

| Q             | A
| ------------- | ---
| Branch?       | 7.2
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | Fix #51765
| License       | MIT

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - 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 the latest branch.
 - For new features, provide some code snippets to help understand usage.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

This allows for fixing #51765; with a consequential Doctrine bundle update, the resolve_target_entities configuration can be injected similarly to ResolveTargetEntityListener in the Doctrine codebase.

Alternatively the config and ValueResolver can be injected using a compiler pass in the Symfony core code, however the value resolver seems to be configured in the Doctrine bundle already.

Commits
-------

3aa64a3 [DoctrineBridge] Add argument to EntityValueResolver to set type aliases
…ekas)

This PR was merged into the 7.3 branch.

Discussion
----------

[VarExporter] Leverage native lazy objects

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | -
| License       | MIT

Let's leverage native lazy objects.

Instead of keeping/updating LazyGhostTrait and LazyProxyTrait, I'm deprecating them in favor of using native lazy proxies directly.

There is one use case that is not covered by native lazy objects: lazy decorators - aka lazy proxies built against an interface or an internal class. For this use case, we keep `ProxyHelper::generateLazyProxy()`.

Commits
-------

a00855a [VarExporter] Leverage native lazy objects
This PR was merged into the 7.3 branch.

Discussion
----------

[PropertyInfo] Deprecate `Type`

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Issues        |
| License       | MIT

A new attempt to #53160, now that `symfony/type-info` is not experimental anymore.

Deprecates:
- `Type` class in favor of the `Type` class of `symfony/type-info`
- `PropertyTypeExtractorInterface::getTypes()` in favor of the `PropertyTypeExtractorInterface::getType()` method
- `ConstructorArgumentTypeExtractorInterface::getTypesFromConstructor()` in favor of the `ConstructorArgumentTypeExtractorInterface::getTypeFromConstructor()` method

The work for upgrading dependent packages has begun already:
- api-platform/core#6979
- symfony/ux#2607

Commits
-------

4d2ccf4 Fix md formatting
f819aed [PropertyInfo] Deprecate Type
This PR was merged into the 7.3 branch.

Discussion
----------

[DoctrineBridge] Strengthen EM reset logic

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Commits
-------

e9c6056 [DoctrineBridge] Strengthen EM reset logic
…ng keys with backend-native namespace separators (nicolas-grekas)

This PR was merged into the 7.3 branch.

Discussion
----------

[Cache] Enable namespace-based invalidation by prefixing keys with backend-native namespace separators

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | Fix #45599
| License       | MIT

This PR adds a `NamespacedPoolInterface` that describes how one can add namespace prefixes to cache pool keys.

This solves #45599 by allowing to use the `:` separator for Redis:
```php
$cache->withSubNamespace('some-prefix')->get($key, fn () => ...);
```

Most importantly, this enables namespace-based cache invalidation, typically with namespaces generated by hashing some context.

Commits
-------

81a8ceb [Cache] Enable namespace-based invalidation by prefixing keys with backend-native namespace separators
…bleTrait` (yceruto)

This PR was merged into the 7.3 branch.

Discussion
----------

[Console] Add support for invokable commands in `LockableTrait`

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | -
| License       | MIT

This enables invokable commands to use `LockableTrait` without extending the `Command` class:
```php
use Symfony\Component\Console\Command\LockableTrait;

#[AsCommand(name: 'foo:lock')]
class FooLockCommand
{
    use LockableTrait;

    public function __invoke(): int
    {
        if (!$this->lock()) {
            return Command::FAILURE;
        }

        // exclusive logic starts here...

        $this->release();

        return Command::SUCCESS;
    }
}
```
Ref: https://symfony.com/doc/current/console/lockable_trait.html

Commits
-------

5595a32 Add support for invokable commands in LockableTrait
…ger:failed:remove` command (arnaud-deabreu)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[Messenger] Add `--class-filter` option to the `messenger:failed:remove` command

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | -
| License       | MIT

This PR adds the `--class-filter` to the `messenger:failed:remove` command which is already available on `messenger:failed:show` command.
It will yield the message ids that match the given class and use it as if it were passed as the `id` argument in the command so the `--force` and `--show-messages` can work with this filter.
When using the filter, the command will prompt for confirmation before removing the messages.

Example output:

```
$ bin/console messenger:failed:remove --class-filter="App\Message\MyMessage"

 There is 16 messages to remove. Do you want to continue? (yes/no) [yes]:
```

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - 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 the latest branch.
 - For new features, provide some code snippets to help understand usage.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Commits
-------

1924719 [Messenger] Add `--class-filter` option to the `messenger:failed:remove` command
…ameter (eltharin)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[Routing] Add alias in `{foo:bar}` syntax in route parameter

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| License       | MIT

Since #54720 we can/have to write route parameters with "destination" as slug:bar,

but if we have two properties with same name example :

`/search-book/{name:author}/{name:category}`

we get the error message : Route pattern "/search-book/{name}/{name}" cannot reference variable name "name" more than once.

Actually to prevent this error we have to use MapEntity as :

```php
    public function bookSearch(
        #[MapEntity(mapping: ['authorName' => 'name'])]
        Author $author,
        #[MapEntity(mapping: ['categoryName' => 'name'])]
        Category $category): Response
    {
```

and we have to remove Mapped Route Parameters :

`#[Route('/search-book/{authorName}/{categoryName}')`

This PR proposal is to remove MapEntity attributes and keep Mapped Route Parameters by adding an alias on it :

`/search-book/{authorName:author.name}/{categoryName:category.name}`

With that, EntityValueResolver will search name in author Entity and name in Category Entity.

We can have url with : `{{ path('bookSearch', {authorName: 'KING', categoryName: 'Horror'}) }}`

Commits
-------

4e2c638 [Routing] Add alias in `{foo:bar}` syntax in route parameter
… (garak)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[DoctrineBridge] add new `DatePointType` Doctrine type

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | Fix #59889
| License       | MIT

Add a new DoctrineType for the DatePoint class.
Please take a look at the issue mentioned above for more details.

Commits
-------

c61752e [DoctrineBridge] add new `DatePointType` Doctrine type
…bute (Oviglo)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[Security] Add methods param in IsCsrfTokenValid attribute

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| License       | MIT

I use a controller action to show a confirmation message for delete entity, i think it could be usefull to add 'methods' param in `#[IsCsrfTokenValid]` attribute.

```php
#[Route('/delete/{id}', name: 'delete', methods: ['GET', 'DELETE'], requirements: ['id' => Requirement::UUID])]
public function delete(Request $request, User $user, UserManager $userManager): Response
{
    if ($request->isMethod('DELETE') && $this->isCsrfTokenValid('delete'.$user->getId(), $request->request->get('_token'))) {
        $userManager->remove($user);

        return $this->redirectToRoute('admin_user_index');
    }

    return $this->render('/admin/user/delete.html.twig', [
        'entity' => $user,
    ]);
}
```

```php
#[Route('/delete/{id}', name: 'delete', methods: ['GET', 'DELETE'], requirements: ['id' => Requirement::UUID])]
#[IsCsrfTokenValid(new Expression('"delete" ~ args["user"].getId()'), methods: ['DELETE'])]
public function delete(Request $request, User $user, UserManager $userManager): Response
{
    if ($request->isMethod('DELETE')) {
        $userManager->remove($user);

        return $this->redirectToRoute('admin_user_index');
    }

    return $this->render('/admin/user/delete.html.twig', [
        'entity' => $user,
    ]);
}
```

The `isCsrfTokenValid`function is ignored if request method is not settings in param.

What do you think about this ?

Commits
-------

640e7a4 [Security] Add methods param in IsCsrfTokenValid attribute
This PR was merged into the 7.3 branch.

Discussion
----------

[Messenger] fix test

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | related to #59978 (comment)
| License       | MIT

Commits
-------

0ec778b fix test
fabpot and others added 17 commits May 6, 2025 08:50
…oyuka)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[ObjectMapper] Condition to target a specific class

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| License       | MIT

We want to be able to choose which property to map according to the target. Here `foo` is mapped to `B` only when the target is `B`. If `C` has a `foo` property it won't be mapped as we only map to `bar`.

```php
use Symfony\Component\ObjectMapper\Attribute\Map;
use Symfony\Component\ObjectMapper\TargetClass;

#[Map(target: B::class)]
#[Map(target: C::class)]
class A
{
    #[Map(target: 'foo', transform: 'strtoupper', if: new TargetClass(B::class))]
    #[Map(target: 'bar')]
    public string $something = 'test';

    public string $doesNotExistInTargetB = 'foo';
}
```

This is a good alternative to groups as we can have one class that has multiple representation.

Commits
-------

a5698aa [ObjectMapper] Condition to target a specific class
…ority over `__invoke()` (GromNaN)

This PR was merged into the 7.3 branch.

Discussion
----------

[Console] Ensure overriding `Command::execute()` keeps priority over `__invoke()`

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Replace #60353
| License       | MIT

Implements #60353 (comment)

Commits
-------

f77c403 Ensure overriding Command::execute() keep priority over __invoke
… and `Option` attributes (alamirault)

This PR was merged into the 7.3 branch.

Discussion
----------

[Console] Set description as first parameter to `Argument` and `Option` attributes

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Issues        | Fix #60359 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT

`Argument` and `Option` arguments were introduced in 7.3

Commits
-------

6763e77 [Console] Set description as first parameter to Argument and Option attributes
…Lite platform (xabbuh)

This PR was merged into the 7.3 branch.

Discussion
----------

[Cache] choose the correctly cased class name for the SQLite platform

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

this was missed in #60159

Commits
-------

41ea779 choose the correctly cased class name for the SQLite platform
This PR was merged into the 7.3 branch.

Discussion
----------

[Console] remove conflict rule

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

Commits
-------

8084241 remove conflict rule
…er component (xabbuh)

This PR was merged into the 7.3 branch.

Discussion
----------

[FrameworkBundle] bump min constraint for the ObjectMapper component

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

fixes the low deps job, we should revert this change after the next beta/rc/stable release

Commits
-------

fe4f1ee bump min constraint for the ObjectMapper component
* 7.2:
  properly skip signal test if the pcntl extension is not installed
  ensure that all supported e-mail validation modes can be configured
  [Security][LoginLink] Throw InvalidLoginLinkException on invalid parameters
  don't hardcode OS-depending constant values
…alk (HypeMC)

This PR was merged into the 7.3 branch.

Discussion
----------

[Messenger] Fix integration with newer versions of Pheanstalk

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Follow-up to #60040.

When I updated the Pheanstalk library, I missed the fact that version 4 internally tracked the [used](https://github.com/pheanstalk/pheanstalk/blob/1459f2f62dddfe28902e0584708417dddd79bd70/src/Pheanstalk.php#L316-L324)/[watched](https://github.com/pheanstalk/pheanstalk/blob/1459f2f62dddfe28902e0584708417dddd79bd70/src/Pheanstalk.php#L329-L337) tube. This was removed in newer versions, so now every call to `useTube()` or `watch()` sends a command to Beanstalkd, leading to unnecessary bandwidth consumption.

This PR adds simple tracking logic to avoid redundant calls to those functions.

Commits
-------

b766607 [Messenger] Fix integration with newer version of Pheanstalk
* 7.2:
  fix tests
  [FrameworkBundle] Ensure `Email` class exists before using it
* 7.2:
  make data provider static
When running `composer install`, instead of warning of the missing extensions, it crashes in PHP code, forcing us to search online for results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.