Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Drupal core uses classes/interfaces/traits from psr/log
package. However, that package is not listed as a requirement in core composer.json file. It gets installed just because some other Drupal dependencies require it.
$ composer why psr/log
composer/composer 1.9.1 requires psr/log (^1.0)
composer/xdebug-handler 1.4.0 requires psr/log (^1.0)
consolidation/annotated-command 4.0.0 requires psr/log (^1)
consolidation/log 1.1.1 requires psr/log (^1.0)
drush/drush dev-master requires psr/log (~1.0)
symfony-cmf/routing 2.1.0 requires psr/log (^1.0)
symfony/debug v4.4.0-RC1 requires psr/log (~1.0)
symfony/error-handler v4.4.0-RC1 requires psr/log (~1.0)
symfony/http-kernel v4.4.0-RC1 requires psr/log (~1.0)
symfony/lock v4.4.0-RC1 requires psr/log (~1.0)
Proposed resolution
Add psr/log: ^1.0
to core composer.json file.
Comment | File | Size | Author |
---|---|---|---|
#21 | 3095948-add-psr-log-21-9.0.x-dev.patch | 1.2 KB | amjad1233 |
Comments
Comment #2
amjad1233Comment #3
Chi CreditAttribution: Chi commentedI suppose composer.lock also needs to be updated.
Comment #4
amjad1233There was no composer.lock file in the repo. So I didn't put.
Comment #5
Chi CreditAttribution: Chi commentedIt's in the root directory.
https://git.drupalcode.org/project/drupal/blob/8.9.x/composer.lock
Comment #6
amjad1233Oh. Sorry, this time I ran composer require psr/log:^1.0 where composer lock was, is this right?
I am not sure if I will rin composer require psr/log:^1.0 in core dir as described in the resolution section, how would it update the root composer.lock?
Comment #7
amjad1233Comment #8
kim.peppernit: can we add this in alphabetical order?
Comment #9
amjad1233Comment #10
amjad1233@kim.pepper
Is it okay to raise an issue for adding sort-packages:true config? (https://git.drupalcode.org/project/drupal/blob/9.0.x/composer.json#L43) or would be overkill?
Comment #11
Chi CreditAttribution: Chi commentedIt's a bit more complicated.
psr/log
belongs todrupal/core
package so it needs to be added to core/composer.json file.I think you can run
composer update drupal/core
from the root directory to update the composer.lock file.Yes.
Comment #12
amjad1233Here comes another one.
Thanks for your help.
Comment #13
Chi CreditAttribution: Chi commentedThis seems irrelevant to the ticket.
Comment #14
amjad1233Sorry. Wonder how I missed this. Guess my habit of ignoring the composer.lock changes.
Comment #15
amjad1233Comment #16
Chi CreditAttribution: Chi commentedI think it's good now. Thank you.
Comment #17
amjad1233Testing against Drupal 9. As this will be needed to be ported to 9.0.x/
Comment #18
alexpottThis needs a reroll at least on 9.0.x which is where it has to go first.
Comment #19
Chi CreditAttribution: Chi commentedComment #20
Chi CreditAttribution: Chi commentedComment #21
amjad1233Here is an updated patch.
Comment #22
Chi CreditAttribution: Chi commented#21 Looks good. Thank you.
Comment #23
alexpottCommitted 2d2cbce and pushed to 9.0.x. Thanks!
Committed c00078f and pushed to 8.9.x. Thanks!
Not bothered with 8.8.x because it's in RC and about to reach 8.8.0 and this is more a task than anything else. Not really a bug.