D9-D10 upgrade causes fatal error in RulesLog.php

Created on 9 November 2023, 10 months ago
Updated 9 July 2024, 2 months ago

Problem/Motivation

Steps to reproduce

Upgraded from Drupal 9 to D10.0 and tried D10.1 as well. Throws "Fatal error: Declaration of Drupal\rules\Logger\RulesLog::log($level, $message, array $context = []) must be compatible with Drupal\Core\Logger\RfcLoggerTrait::log($level, Stringable|string $message, array $context = []): void in /home/djqias303hch/public_html/modules/rules/src/Logger/RulesLog.php on line 52".

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ’ฌ Support request
Status

Active

Version

4.0

Component

Rules Core

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States brewerkr

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

Comments & Activities

  • Issue created by @brewerkr
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TR Cascadia

    Unlikely you're using the latest version of Rules. That was changed over a year ago in #3288059: [D10] Update code that implements \Psr\Log\LoggerInterface due to Psr/Log version 3 โ†’

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11

    chetan 11 โ†’ made their first commit to this issueโ€™s fork.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update 10 months ago
    PHPLint Failed
  • @chetan-11 opened merge request.
  • Status changed to Needs review 10 months ago
  • Status changed to Postponed: needs info 10 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TR Cascadia
  • Status changed to Closed: cannot reproduce 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TR Cascadia

    Requested information has not been provided

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark S@ilor

    Allow me to re-open the issue. I have the exact same error.
    Updated to most recent version of Rules: "drupal/rules": "^3.0@alpha", as part of upgrade of Drupal 9.5.2 to Drupal 10.2..6

  • Status changed to Active 4 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark S@ilor
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TR Cascadia

    The change cited in #2 was made in accordance with the Drupal core change record: https://www.drupal.org/node/3284415 โ†’

    If there has been a subsequent change in Drupal core that supercedes this then please cite that change.

  • Status changed to Postponed: needs info 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TR Cascadia
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark S@ilor

    I cannot cite anything. I'm just reporting, I have the exact same error message, and a search led me to this issue.

    I'll be happy to provide any info needed to investigate. To start with, here's the content of composer.json:

    {
    "name": "drupal/legacy-project",
    "description": "Project template for Drupal 9 projects with composer following drupal/drupal layout",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": " https://www.drupal.org/project/drupal โ†’ ",
    "support": {
    "docs": " https://www.drupal.org/docs/user_guide/en/index.html โ†’ ",
    "chat": " https://www.drupal.org/node/314178 โ†’ "
    },
    "repositories": [
    {
    "type": "composer",
    "url": "https://packages.drupal.org/8"
    }
    ],
    "require": {
    "composer/installers": "^1.9",
    "cweagans/composer-patches": "^1.7",
    "drupal/admin_toolbar": "^3.1",
    "drupal/animated_gif": "^2.0",
    "drupal/backup_migrate": "^5.0",
    "drupal/block_class": "^2.0@beta",
    "drupal/bootstrap": "^3.24",
    "drupal/bootstrap_barrio": "^5.5",
    "drupal/color": "^1.0",
    "drupal/composer_deploy": "^1.7",
    "drupal/context": "^5.0@RC",
    "drupal/core-composer-scaffold": "^10",
    "drupal/core-project-message": "^10",
    "drupal/core-recommended": "^10",
    "drupal/devel": "^5.0",
    "drupal/easy_breadcrumb": "^2.0",
    "drupal/embed_view_block": "^1.0@beta",
    "drupal/entity_reference_revisions": "^1.9",
    "drupal/gin": "^3.0@beta",
    "drupal/gin_lb": "^1.0@RC",
    "drupal/gin_login": "^1.2",
    "drupal/gin_toolbar": "^1.0@beta",
    "drupal/honeypot": "^2.0",
    "drupal/iframe": "^2.18",
    "drupal/inline_responsive_images": "^3.0@beta",
    "drupal/lang_dropdown": "^2.1",
    "drupal/layout_builder_admin_theme": "^2.0",
    "drupal/layout_builder_at": "^2.13",
    "drupal/layout_builder_modal": "^1.1",
    "drupal/layout_builder_styles": "^2.0",
    "drupal/layout_disable": "^2.0",
    "drupal/linkit": "^6.1",
    "drupal/maillog": "^1.0",
    "drupal/mailsystem": "^4.3",
    "drupal/media_library_theme_reset": "^1.1",
    "drupal/media_responsive_thumbnail": "^1.2",
    "drupal/metatag": "^1.19",
    "drupal/mimemail": "^1.0@alpha",
    "drupal/paragraphs": "^1.13",
    "drupal/path_redirect_import": "^2.0",
    "drupal/pathauto": "^1.9",
    "drupal/plausible": "^2.0@beta",
    "drupal/quick_node_clone": "^1.18",
    "drupal/redirect": "^1.8",
    "drupal/rules": "^3.0@alpha",
    "drupal/search_api": "^1.23",
    "drupal/simplenews": "^4.0",
    "drupal/smtp": "^1.2",
    "drupal/symfony_mailer": "^1.1@beta",
    "drupal/term_condition": "^2.0",
    "drupal/theme_switcher": "^2.0",
    "drupal/token": "^1.10",
    "drupal/upgrade_status": "^4.3",
    "drupal/views_data_export": "^1.2",
    "drupal/views_taxonomy_term_name_into_id": "^1.0@RC",
    "drupal/views_term_hierarchy_weight_field": "^1.1",
    "drupal/viewsreference": "^2.0@beta",
    "drupal/webform": "^6.2@beta",
    "drupal/weight": "^3.4",
    "drush/drush": "^12.5",
    "wikimedia/composer-merge-plugin": "^2.0"
    },
    "conflict": {
    "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
    "sort-packages": true,
    "allow-plugins": {
    "composer/installers": true,
    "drupal/core-composer-scaffold": true,
    "drupal/core-project-message": true,
    "phpstan/extension-installer": true,
    "dealerdirect/phpcodesniffer-composer-installer": true,
    "wikimedia/composer-merge-plugin": true,
    "cweagans/composer-patches": true
    }
    },
    "extra": {
    "enable-patching": true,
    "patches": {
    "drupal/core": {
    " https://www.drupal.org/project/drupal/issues/2816447#comment-14615388 ๐Ÿ› Get feed title in correct language Needs work ": " https://www.drupal.org/files/issues/2022-07-19/2816447-49.patch โ†’ "
    }
    }
    },
    "extra": {
    "merge-plugin": {
    "include": [
    "modules/contrib/webform/composer.libraries.json"
    ]
    },
    "drupal-scaffold": {
    "locations": {
    "web-root": "web/"
    }
    },
    "installer-paths": {
    "web/core": [
    "type:drupal-core"
    ],
    "web/libraries/{$name}": [
    "type:drupal-library"
    ],
    "web/modules/contrib/{$name}": [
    "type:drupal-module"
    ],
    "web/profiles/contrib/{$name}": [
    "type:drupal-profile"
    ],
    "web/themes/contrib/{$name}": [
    "type:drupal-theme"
    ],
    "web/drush/Commands/contrib/{$name}": [
    "type:drupal-drush"
    ],
    "web/modules/custom/{$name}": [
    "type:drupal-custom-module"
    ],
    "web/profiles/custom/{$name}": [
    "type:drupal-custom-profile"
    ],
    "web/themes/custom/{$name}": [
    "type:drupal-custom-theme"
    ]
    }
    }
    }

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark S@ilor

    To the maintainer
    Not sure what you will have me do here. I'm more than happy to provide any info, you need.

    According to #2 / Core change, I have tried to follow the recommendations, thus tried both suggestions. Both create an additional error.

    So, as an example, replacing line 52 in /modules/rules/src/Logger/RulesLog.php with
    public function log($level, string|\Stringable $message, array $context = []): void {
    or
    public function log($level, $message, array $context = []): void {

    produces the following error:
    TypeError: Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch(): Argument #1 ($event) must be of type object, string given, called in /var/www/html/web/modules/contrib/rules/src/Logger/RulesLog.php on line 75 in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (line 89 of /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php).

  • Status changed to Closed: works as designed 4 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark S@ilor

    I'm closing this one and have created https://www.drupal.org/project/rules/issues/3447241 ๐Ÿ› D9-D10 upgrade causes fatal error in RulesLog.php Active

  • Status changed to Active 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TR Cascadia

    My questions are important because any change made to the method signature has to be done in a backwards-compatible manner so that it does not break existing sites that use Rules.

    Thus, it is critical for me to know when and where this method signature was changed, so I can modify the dependencies appropriately.

    The change was probably made in Symfony, and Drupal probably changed the minimum version of Symfony required for core Drupal, triggering the error. But which version of core Drupal?

    I will eventually research this and figure it out on my own, but if you would like something done sooner please do that work yourself and provide me with the information I requested.

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark S@ilor

    Hi TR,

    If I could fix this myself, I would. What information are you requesting?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TR Cascadia
Production build 0.71.5 2024