phpstan-drupal icon indicating copy to clipboard operation
phpstan-drupal copied to clipboard

Do not allow loggers to be class properties if set from logger factory

Open mglaman opened this issue 5 years ago • 0 comments

Loggers will break serialization if they're set from the LoggerFactory and not a defined logger channel service.

Background: https://www.drupal.org/project/commerce/issues/3038430

You can serialize a class in Drupal with a logger, but only if it was retrieved directly from the container. See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21DependencyInjection%21DependencySerializationTrait.php/trait/DependencySerializationTrait/8.2.x

mglaman avatar Aug 09 '20 14:08 mglaman