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
- Download the dev version in Drupal 10:
composer require drupal/backup_migrate:5.0.x-dev@dev - Install the module:
drush in backup_migrate - Go to /admin/config/development/backup_migrate
- 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
Issue fork backup_migrate-3304922
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
Comment #3
damienmckennaDoh! Thanks.
I'll do a new 5.0.3 update with this fix, and will also add it to 5.1.x.
Comment #4
ressaGreat, thanks!
Comment #5
damienmckennaComment #7
damienmckennaCommitted. Thank you.
Comment #9
damienmckennaFYI while I've committed this fix, I'm holding the next release until the D10 tests are working properly, see #3305241 for details.
Comment #10
ressaSounds good, thanks for maintaining and expanding the features of the module.
Comment #11
geoanders commentedAlso ran into this issue and can confirm void return type hint fixes issue.