Commit 344f262
committed
bug #563 Fix tags list to use consecutive keys (GromNaN)
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 list1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments