Problem/Motivation

If you install the module (both 5.0.x and 5.1.x) in Drupal 10, you get a WSOD and this error message:

Fatal error: Declaration of Drupal\backup_migrate\Drupal\Environment\DrupalSetMessageLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\AbstractLogger::log($level, Stringable|string $message, array $context = []): void in /app/web/modules/contrib/backup_migrate/src/Drupal/Environment/DrupalSetMessageLogger.php on line 22

For more, see the Change record Update code that implements \Psr\Log\LoggerInterface due to Psr/Log version 3 .

Steps to reproduce

  1. Download the dev version in Drupal 10: composer require drupal/backup_migrate:5.0.x-dev@dev
  2. Install the module: drush in backup_migrate
  3. Go to /admin/config/development/backup_migrate
  4. Se the Fatal error: Declaration of Drupal\backup_migrate\Drupal\Environment\DrupalSetMessageLogger [...] message

Proposed resolution

Make the logger Drupal 9 and Drupal 10 compatible:

As long as the return typehint is implemented then it is possible to be compatible with Drupal 9 & 10. Changing ::log to have the void return type will make a logger compatible with both major versions.

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

From the Change record Update code that implements \Psr\Log\LoggerInterface due to Psr/Log version 3 .

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ressa created an issue. See original summary.

damienmckenna’s picture

Status: Active » Needs review
Parent issue: » #3223059: Plan for Backup and Migrate 5.1.0

Doh! Thanks.

I'll do a new 5.0.3 update with this fix, and will also add it to 5.1.x.

ressa’s picture

Great, thanks!

  • DamienMcKenna committed 61d1f8b on 5.0.x
    Issue #3304922 by ressa, DamienMcKenna: Drupal 10: Fatal error, logger...
damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thank you.

  • DamienMcKenna committed 5c47cc9 on 5.1.x
    Issue #3304922 by ressa, DamienMcKenna: Drupal 10: Fatal error, logger...
damienmckenna’s picture

FYI while I've committed this fix, I'm holding the next release until the D10 tests are working properly, see #3305241 for details.

ressa’s picture

Sounds good, thanks for maintaining and expanding the features of the module.

geoanders’s picture

Also ran into this issue and can confirm void return type hint fixes issue.

Status: Fixed » Closed (fixed)

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