#3038430: Unable to checkout on php7.3 has shown that the Logger is not serializable. It is constructed by the factory, which makes it invisible to DependencySerializationTrait. So, we should be assigning the factory to a class attribute instead, and using it to get a logger where needed.

The only two affected classes are the two plugin forms from the title. Right now they're not crashing, but no need to risk future weird behavior.

CommentFileSizeAuthor
#4 3040425-4.patch3.7 KBbojanz

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Looks like we can also define our own logger service like this:

  logger.channel.commerce_payment:
    class: Drupal\Core\Logger\LoggerChannel
    factory: logger.factory:get
    arguments: ['commerce_payment']

Then inject that.

bojanz’s picture

Title: Stop using $this->logger in PaymentMethodAddForm and PaymentMethodEditForm » Fix logger usage in PaymentMethodAddForm and PaymentMethodEditForm
bojanz’s picture

Status: Active » Needs review
StatusFileSize
new3.7 KB

  • bojanz committed b26a160 on 8.x-2.x
    Issue #3040425 by bojanz: Fix logger usage in PaymentMethodAddForm and...
bojanz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.