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\media\Plugin\media\Source\OEmbed and \Drupal\media\Controller\OEmbedIframeController expect the \Drupal\Core\Logger\LoggerChannelInterface class injected into their constructors. This is incompatible with the monolog module.
Related issues for contrib:
#2884802: Incompatible with monolog
#2960531: Incompatible with monolog module
#2868851: Search api and monolog module don't work together.
#2909673: Doesn't work with Monolog module
Proposed resolution
Change signature to use \Psr\Log\LoggerInterface instead.
Kudos to @rikki_iki for finding this :)
Comment | File | Size | Author |
---|---|---|---|
#2 | 3000424-oembed-monolog-2.patch | 5.7 KB | acbramley |
Comments
Comment #2
acbramley CreditAttribution: acbramley at PreviousNext commentedComment #3
acbramley CreditAttribution: acbramley at PreviousNext commentedComment #4
acbramley CreditAttribution: acbramley at PreviousNext commentedComment #6
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #7
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedLooks good to me, the interface of
LoggerChannelInterface
says:So I can't see any issues with changing this. Will see what the testbot says. Not exactly sure if testing this makes sense, I suppose we could use a different logger in the oembed tests, but haven't seen any examples of that done elsewhere.
Comment #8
dawehnerI am wondering whether something like this could be automatically checked.
Comment #9
dawehnerOtherwise, totally +1
Comment #10
alexpottI think best thing to do will be to add a follow-up task to mark the LoggerChannelInterface @internal. So at least IDEs will help us. This task should also replace other incorrect typehints.
Also how does this break the monolog module? I don't think this is true since #2749859: Logger channel factory must return instances of LoggerChannelInterface.
But there is no harm in obeying the instructions not to use it that exist on the interface. As an API widening (not change) I don't think this needs tests.
Committed and pushed e6a096cf45 to 8.7.x and faf551f882 to 8.6.x. Thanks!