Skip to content

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Nov 6, 2025

Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #59088 (comment)
License MIT

Instead of #62327

$indexAttribute ?? '' => $attribute->index,
];
if (null === $defaultPriority) {
$defaultPriority = $attribute->priority ?? 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only the first php-attribute can define a default priority and default index
and defaults defined by this first php-attribute have lower priority than defaults defined by static methods (getDefaultName et al.)

Note that we'd better deprecate static methods for defaults. php-attributes are cleaner IMHO. For 8.1 I suppose.

@nicolas-grekas nicolas-grekas force-pushed the di-fix-multi-tagged-item branch 3 times, most recently from f29141d to 074c005 Compare November 6, 2025 15:56
@nicolas-grekas nicolas-grekas changed the base branch from 7.4 to 7.3 November 6, 2025 16:03
@nicolas-grekas nicolas-grekas modified the milestones: 7.4, 7.3 Nov 6, 2025
@nicolas-grekas nicolas-grekas force-pushed the di-fix-multi-tagged-item branch 2 times, most recently from 811c361 to f7e67db Compare November 7, 2025 12:59
@nicolas-grekas nicolas-grekas force-pushed the di-fix-multi-tagged-item branch from f7e67db to e31b192 Compare November 7, 2025 14:01
Copy link
Member Author

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR updated, no reordering anymore, which means no behavior change when not using multiple AsTaggeditem.

@nicolas-grekas nicolas-grekas merged commit 6a854c5 into symfony:7.3 Nov 12, 2025
9 of 11 checks passed
This was referenced Nov 13, 2025
@nicolas-grekas nicolas-grekas deleted the di-fix-multi-tagged-item branch November 13, 2025 18:09
nicolas-grekas added a commit that referenced this pull request Nov 24, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

[DependencyInjection] Remove unused variable

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

This variable became unused after #62329.

Commits
-------

f75f12f [DependencyInjection] Remove unused variable
@fabpot fabpot mentioned this pull request Dec 7, 2025
GromNaN added a commit to GromNaN/monolog-bundle that referenced this pull request Dec 7, 2025
Workaround a bug introduced in symfony/symfony#62329
@GromNaN GromNaN changed the title [DependencyInjection] Fix merging explicit tags and #[AsTaggeditem] [DependencyInjection] Fix merging explicit tags and #[AsTaggedItem] Dec 7, 2025
GromNaN added a commit to symfony/monolog-bundle that referenced this pull request Dec 7, 2025
This PR was merged into the 3.x branch.

Discussion
----------

Fix tags list to use consecutive keys

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

Workaround a bug introduced in symfony/symfony#62329
The Symfony code incorrectly assumes that the tags array is a list. But we use `array_filter` which leaves gaps in the array keys. Fixed here by using `array_values` to reset the keys.

Fix [failing job](https://github.com/symfony/monolog-bundle/actions/runs/19731209625/job/56532483316):

```
There were 3 errors:

1) Symfony\Bundle\MonologBundle\Tests\DependencyInjection\Compiler\AddProcessorsPassTest::testEmptyTagsAreIgnoredWhenNonEmptyArePresent with data set "with app channel" (array(array(), array('app')), array(array('useMicrosecondTimestamps', array('%monolog.use_microseconds%')), array('pushProcessor', array(Symfony\Component\DependencyInjection\Reference Object (...)))), array())
Undefined array key 0

/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php:86
/home/runner/work/monolog-bundle/monolog-bundle/src/DependencyInjection/Compiler/AddProcessorsPass.php:55
/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/Compiler/Compiler.php:73
/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/ContainerBuilder.php:820
/home/runner/work/monolog-bundle/monolog-bundle/tests/DependencyInjection/Compiler/AddProcessorsPassTest.php:119

2) Symfony\Bundle\MonologBundle\Tests\DependencyInjection\Compiler\AddProcessorsPassTest::testEmptyTagsAreIgnoredWhenNonEmptyArePresent with data set "with my_channel channel" (array(array(), array('my_channel')), array(array('useMicrosecondTimestamps', array('%monolog.use_microseconds%'))), array(array('pushProcessor', array(Symfony\Component\DependencyInjection\Reference Object (...)))))
Undefined array key 0

/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php:86
/home/runner/work/monolog-bundle/monolog-bundle/src/DependencyInjection/Compiler/AddProcessorsPass.php:55
/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/Compiler/Compiler.php:73
/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/ContainerBuilder.php:820
/home/runner/work/monolog-bundle/monolog-bundle/tests/DependencyInjection/Compiler/AddProcessorsPassTest.php:119

3) Symfony\Bundle\MonologBundle\Tests\DependencyInjection\Compiler\AddProcessorsPassTest::testEmptyTagsAreIgnoredWhenNonEmptyArePresent with data set "with method and no channel" (array(array(), array('foo')), array(array('useMicrosecondTimestamps', array('%monolog.use_microseconds%')), array('pushProcessor', array(array(Symfony\Component\DependencyInjection\Reference Object (...), 'foo')))), array(array('pushProcessor', array(array(Symfony\Component\DependencyInjection\Reference Object (...), 'foo')))))
Undefined array key 0

/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php:86
/home/runner/work/monolog-bundle/monolog-bundle/src/DependencyInjection/Compiler/AddProcessorsPass.php:55
/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/Compiler/Compiler.php:73
/home/runner/work/monolog-bundle/monolog-bundle/vendor/symfony/dependency-injection/ContainerBuilder.php:820
/home/runner/work/monolog-bundle/monolog-bundle/tests/DependencyInjection/Compiler/AddProcessorsPassTest.php:119
```

Commits
-------

2127520 Fix tags must be a list
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.

3 participants