EmailLogger::log / ErrorLogMessageFormatter::log must be compatible with RfcLoggerTrait::log

Created on 22 August 2023, over 1 year ago
Updated 11 April 2024, 9 months ago

Not sure if this is D10 specific, but I hit it after an attempt to upgrade to D10.

Running a simple "drush cr", I hit the following errors

PHP Fatal error: Declaration of Drupal\emaillog\Logger\EmailLogger::log($level, $message, array $context = []) must be compatible with Drupal\Core\Logger\RfcLoggerTrait::log($level, Stringable|string $message, array $context = []): void in /app/web/modules/contrib/logging_alerts/emaillog/src/Logger/EmailLogger.php on line 53

PHP Fatal error: Declaration of Drupal\emaillog\Logger\EmailLogger::log($level, $message, array $context = []) must be compatible with Drupal\Core\Logger\RfcLoggerTrait::log($level, Stringable|string $message, array $context = []): void in /app/web/modules/contrib/logging_alerts/emaillog/src/Logger/EmailLogger.php on line 53

Looks like this is about the structure of the log() function in these two files.

If I change:

public function log($level, $message, array $context = []) {

to

public function log($level, \Stringable|string $message, array $context = []): void {

Things work great again in D10.

Not sure if this is a D10 specific issue. Patch incoming.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada TrevorBradley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024